wa0x6e / Cake-Resque

Resque plugin for CakePHP : for creating background jobs that can be processed offline later
MIT License
159 stars 56 forks source link

startscheduler fails to start scheduler process, warns "The scheduler worker is already running" #113

Open chrisinmtown opened 4 years ago

chrisinmtown commented 4 years ago

Using CakePHP v2.10.22 and PHP Resque Version 4.1.2. I use this command to start the scheduler:

cake CakeResque.CakeResque startscheduler --interval 5

But it fails to start the expected process. The output is:

Creating the scheduler workers
The scheduler worker is already running

There's probably an error between the keyboard and the chair here, but I'm a bit puzzled. I wonder if this command simply declines to start a new one because it has detected a running scheduler? But I cannot find a scheduler in the process table. Why/how does it detect a running scheduler?

wa0x6e commented 4 years ago

Check that there's no leftover pid file, due to previous incorrect shutdown.

chrisinmtown commented 4 years ago

Where is a PID file? In our case this seems to rely on ResqueStatus which caches data in Redis. Yes I agree that there was a previous incorrect shutdown, but the start scheduler should be robust to a machine losing power or other unexpected crash that may leave junk on the filesystem.