3scale / apisonator

Red Hat 3scale API Management Apisonator backend
https://3scale.net
Apache License 2.0
35 stars 27 forks source link

Fix concurrency issue in BackgroundJob #191

Closed davidor closed 4 years ago

davidor commented 4 years ago

This PR replaces the usage of a class variable in BackgroundJob.

That class variable causes problems when using the async mode because fibers can modify it while others still need to read it. Luckily, with the current code, the only attribute affected is "enqueue_time", which is not accurate anyway (see https://github.com/3scale/apisonator/issues/18).

Even without taking the async mode into consideration using a class var is counter-intuitive. The arguments of a particular job (service ID, app ID, etc.) should belong to an instance, they shouldn't be stored in a class var.

davidor commented 4 years ago

Yes, I checked. I didn't see any other usages of @args.