bree icon indicating copy to clipboard operation
bree copied to clipboard

Job sometimes reports as "already running" when it isn't, and then runs anyway

Open neilenns opened this issue 1 year ago • 0 comments

Describe the bug

Node.js version: 20.11.x

OS version: Alpine 3.18

Description:

I have a job that is scheduled to run "every 1 minute" and takes about 5 seconds to complete. Every so often Bree will think the job is already running when it isn't, then will then happily start it running anyway. Here's an example from my logs:

2024-01-26T02:10:12.437Z [jobs] Worker deleted: getVatsimData
2024-01-26T02:10:12.438Z [jobs] Current jobs: getVatsimEndpoints, importAirports, getVatsimData, getVatsimTransceivers
2024-01-26T02:10:12.439Z [jobs] Current workers: 
2024-01-26T02:10:59.996Z [jobs] Worker created: getVatsimData
2024-01-26T02:10:59.997Z [jobs] Current jobs: getVatsimEndpoints, importAirports, getVatsimData, getVatsimTransceivers
2024-01-26T02:10:59.997Z [jobs] Current workers: getVatsimData
2024-01-26T02:11:00.001Z [jobs] Error: Job "getVatsimData" is already running
2024-01-26T02:11:00.063Z [jobs] Worker for job "getVatsimData" online

I'm using the worker created and worker deleted events to write out the current jobs and current workers when jobs are created and deleted. In the logs above getVatsimData finished running at 2:10:12 and there were no active workers when it exited. The next run of the job started at 2:10:59 and resulted in the "already running" error, but then started anyway just 62ms later.

Expected behavior

No warning.

Code to reproduce

No standalone code, but my bree code is in a single file in my repo.

Checklist

  • [X] I have searched through GitHub issues for similar issues.
  • [X] I have completely read through the README and documentation.
  • [X] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

neilenns avatar Jan 26 '24 03:01 neilenns