hyku
hyku copied to clipboard
TenantMaintenanceJob issues
Descriptive summary
Auto-scheduled tenant jobs need to be reworked.
Rationale
Current logic in the main branch does not work:
- On main branch, TenantMaintenanceJob fails when it tries to call
Account.each
rather thanAccount.find_each
If the above is fixed...
- Method
find_job
inaccount.rb
callsActiveJob::Base.find_job(klass: klass, tenant_id: self.tenant)
which always returns nil. It does not find enqueued jobs.
Expected behavior
Each job gets scheduled only once per tenant. If job is already enqueued, it does not get enqueued another time.
Actual behavior
Job fails because method each
is not valid on class Account. If this is fixed, each time the worker starts, it enqueues more jobs, regardless of whether they are already in the queue.