mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Connect before processing presence
fire_event's timeout is in milliseconds. Under the hood it calls connect_pull with a seconds timeout. Just call connect_pull directly before processing presense events.
This commit is contained in:
parent
b9590339d6
commit
7bd34f6c2c
1 changed files with 4 additions and 4 deletions
|
@ -337,7 +337,9 @@ class Maintenance(SignalHandlingMultiprocessingProcess):
|
|||
'''
|
||||
Fire presence events if enabled
|
||||
'''
|
||||
if self.presence_events:
|
||||
# On the first run it may need more time for the EventPublisher
|
||||
# to come up and be ready. Set the timeout to account for this.
|
||||
if self.presence_events and self.event.connect_pull(timeout=3):
|
||||
present = self.ckminions.connected_ids()
|
||||
new = present.difference(old_present)
|
||||
lost = old_present.difference(present)
|
||||
|
@ -347,9 +349,7 @@ class Maintenance(SignalHandlingMultiprocessingProcess):
|
|||
'lost': list(lost)}
|
||||
self.event.fire_event(data, tagify('change', 'presence'))
|
||||
data = {'present': list(present)}
|
||||
# On the first run it may need more time for the EventPublisher
|
||||
# to come up and be ready. Set the timeout to account for this.
|
||||
self.event.fire_event(data, tagify('present', 'presence'), timeout=3)
|
||||
self.event.fire_event(data, tagify('present', 'presence'))
|
||||
old_present.clear()
|
||||
old_present.update(present)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue