mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-04 19:28:49 +08:00
Merge #145 Allow handlers to return extra work to the scheduler.
This commit is contained in:
@@ -157,9 +157,19 @@ class MessageWorker(threading.Thread):
|
||||
log.debug("Handler is NO_OP: %s" % idx)
|
||||
else:
|
||||
log.info("Calling %s" % idx)
|
||||
handler(conf, session, msg)
|
||||
further_work = handler(conf, session, msg) or []
|
||||
log.info("Done with %s" % idx)
|
||||
|
||||
# Handlers can *optionally* return a list of fake messages that
|
||||
# should be re-inserted back into the main work queue. We can use
|
||||
# this (for instance) when we submit a new component build but (for
|
||||
# some reason) it has already been built, then it can fake its own
|
||||
# completion back to the scheduler so that work resumes as if it
|
||||
# was submitted for real and koji announced its completion.
|
||||
for event in further_work:
|
||||
log.info(" Scheduling faked event %r" % event)
|
||||
self.incoming_work_queue.put(event)
|
||||
|
||||
|
||||
class Poller(threading.Thread):
|
||||
def __init__(self, outgoing_work_queue, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user