/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to mandos

  • Committer: teddy at recompile
  • Date: 2020-02-05 20:32:33 UTC
  • mto: This revision was merged to the branch mainline in revision 396.
  • Revision ID: teddy@recompile.se-20200205203233-450ojm36jseglq4m
Server: Stagger checker runs when creating clients

To avoid checkers for all clients all running at the same time
periodically, schedule every initially scheduled future checker to run
at a time in the future a random amount of the interval, from the
current time.

* mandos (Client.init_checker): Schedule the first scheduled future
  run of a checker to be a randomly chosen amount of this client's
  "interval" (instead of a full interval).

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
import collections
79
79
import codecs
80
80
import unittest
 
81
import random
81
82
 
82
83
import dbus
83
84
import dbus.service
1035
1036
        if self.checker_initiator_tag is not None:
1036
1037
            GLib.source_remove(self.checker_initiator_tag)
1037
1038
        self.checker_initiator_tag = GLib.timeout_add(
1038
 
            int(self.interval.total_seconds() * 1000),
 
1039
            random.randrange(int(self.interval.total_seconds() * 1000
 
1040
                                 + 1)),
1039
1041
            self.start_checker)
1040
1042
        # Schedule a disable() when 'timeout' has passed
1041
1043
        if self.disable_initiator_tag is not None: