GothenburgBitFactory / bugwarrior

Pull github, bitbucket, and trac issues into taskwarrior
http://pypi.python.org/pypi/bugwarrior
GNU General Public License v3.0
732 stars 209 forks source link

Decrement currently_running one time. Fix #897. #943

Closed ryneeverett closed 1 year ago

ryneeverett commented 2 years ago

Unfortunately this was pointed out by @fmauch but it appears that I accidentally reverted it when rebasing #825.

The currently_running -= 1 will also be reached once yield is called, as the generator simply continues directly after the yield statement (as far as I understood generators).

https://github.com/ralphbean/bugwarrior/pull/825#discussion_r659296257

This explains the situation of #897:

We hit the line log.exception("Worker for [%s] failed: %s" % (target, e)) but then somehow miss the line log.exception(f"Aborted {target} due to critical error."

https://github.com/ralphbean/bugwarrior/issues/897#issuecomment-1096838119

Because the decrement was occurring twice for a previous service, the while currently_running > 0 loop was ending before getting to the SERVICE_FINISHED_ERROR in the queue.

Also, improve logging consistency in this section.

fmauch commented 2 years ago

Just as a quick comment: This does not resolve #897 for me, still closing 100 tasks on a missing vpn connection to our company's gitlab server. Unfortunately, my time resources are very limited atm to look into this.

ryneeverett commented 2 years ago

Thanks for trying! If you find time to post logs with this patch I'd be interested to take a look.

fmauch commented 2 years ago

Thanks for trying! If you find time to post logs with this patch I'd be interested to take a look.

The logs from https://github.com/ralphbean/bugwarrior/issues/897#issuecomment-1169544672 are created with this patch.