Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total job process time logged is not correct #18

Open
davidor opened this issue Apr 16, 2018 · 0 comments
Open

Total job process time logged is not correct #18

davidor opened this issue Apr 16, 2018 · 0 comments

Comments

@davidor
Copy link
Contributor

davidor commented Apr 16, 2018

For each processed job, the workers log some information like the process time, the total time (process time + time in the queue), etc.

The second is not correct. The reason is that the enqueue time is stored in Redis by a listener when it enqueues a job:

Resque.enqueue(ReportJob, service_id, data, Time.now.getutc.to_f, context_info)

Whereas the total time is calculated by the worker when it finished processing a job:

" #{(end_time.to_f - enqueue_time).round(5)}"+

That's the reason why sometimes we get inconsistent numbers in the logs. For example, sometimes we see that the process time is greater than the process time plus the time in the queue. In many deployments, those two timestamps always come from different machines (listeners vs background workers) so comparing them is not reliable.

davidor added a commit that referenced this issue Apr 14, 2020
This causes problems when using the async mode because all the fibers
share that @Args class var. Luckily, with the current code, the only
attribute affected is "enqueue_time", which is not
accurate anyway (see #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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant