I've got a Rails server on a Kubernetes cluster. It uses a Mysql backend. We've got a class that does something like:
and the Job
However, the job fails to find the database record!
We tried several things to investigate the problem
sleep(1)command inside the job before it looks for the record. This fixes the problem
DatabaseModel.last.idin the class and in the job. In the class it would return
1000and in the job it would return
999. i.e. the record had not yet reflected in the database for the job for some reason.
As far as I understand there is only one copy of the database on the server so I do not understand how this could be happening. This may be a bit of a reach for someone to be able to help without more context, but it's worth a try :)