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

Added nested directory daily_update/ inside app/workers/ for autoloading. #4122

Conversation

shashwatkathuria
Copy link
Contributor

@shashwatkathuria shashwatkathuria commented Jul 28, 2020

What this PR does

In my development environment, I was getting NameErrors relating to each worker inside app/workers/daily_update on running rails batch:update_daily. They were not getting autoloaded as they were inside the nested directory. The difference can be seen using the command puts ActiveSupport::Dependencies.autoload_paths. Added * to include all nested directories in future also.
Putting the error log of one such worker here:

2020-07-28T20:06:33.927Z pid=21034 tid=gssgzvuli WARN: {"context":"Job raised exception","job":{"retry":true,"queue":"daily_update","unique":"until_executed","args":[],"class":"FindAssignmentsWorker","jid":"0c658b29197a28457ea2eab8","created_at":1595966792.626286,"lock_timeout":0,"lock_expiration":null,"unique_prefix":"uniquejobs","unique_args":[],"unique_digest":"uniquejobs:9d48b6d34fb898e86b684045aa6f072a","newrelic":{},"enqueued_at":1595966792.6272924},"jobstr":"{\"retry\":true,\"queue\":\"daily_update\",\"unique\":\"until_executed\",\"args\":[],\"class\":\"FindAssignmentsWorker\",\"jid\":\"0c658b29197a28457ea2eab8\",\"created_at\":1595966792.626286,\"lock_timeout\":0,\"lock_expiration\":null,\"unique_prefix\":\"uniquejobs\",\"unique_args\":[],\"unique_digest\":\"uniquejobs:9d48b6d34fb898e86b684045aa6f072a\",\"newrelic\":{},\"enqueued_at\":1595966792.6272924}"}
2020-07-28T20:06:33.927Z pid=21034 tid=gssgzvuli WARN: NameError: uninitialized constant FindAssignmentsWorker

Screenshots

Before

Screenshot from 2020-07-29 01-46-12
Screenshot from 2020-07-29 01-52-40

After

Screenshot from 2020-07-29 01-39-35
Screenshot from 2020-07-29 01-52-23

The daily_update directory was not getting autoloaded, hence the NameError for each worker inside app/workers/daily_update.
@shashwatkathuria shashwatkathuria changed the title Added nested directory daily_update/ inside app/workers for autoloading. Added nested directory daily_update/ inside app/workers/ for autoloading. Jul 28, 2020
@ragesoss ragesoss merged commit ed3d910 into WikiEducationFoundation:master Jul 31, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants