Search code examples
phpherokuworkerheroku-cli

Heroku Worker Caching


I'm having trouble getting my worker process to update in Heroku. I have a worker dyno set in my Procfile that is connected to a Redis instance; I cannot see changes that I make to this file after deploying.

I've tried:

  • Resetting the dyno using heroku ps:restart worker.1 -a [appname]
  • Restarting all dynos using heroku ps:restart -a [appname]
  • Changing the contents of the file so the size is different
  • Changing the Procfile to point to a different PHP file

Nothing works. It looks like it picked up some of my changes overnight (maybe during reboot?) but I can't force it to pick up the changes... any ideas?


Solution

  • Logs to the rescue... I had an issue with my required include file paths, which was causing the build to fail. It was defaulting to the last successful build, which is why it looked like it was caching.

    I was able to find this by watching the logs during the build:

    heroku[worker.1]: Starting process with command `php bin/worker.php`
    heroku[worker.1]: State changed from starting to up
    heroku[worker.1]: Process exited with status 255
    app[worker.1]: PHP Warning:  require_once(../vendor/autoload.php): failed to open stream: No such file or directory in /app/bin/worker.php on line 9
    app[worker.1]: PHP Fatal error:  require_once(): Failed opening required '../vendor/autoload.php' (include_path='.:/app/.heroku/php/lib/php') in /app/bin/worker.php on line 9
    heroku[worker.1]: State changed from up to crashed
    

    Once I solved the build errors it no longer 'cached' and everything worked properly.

    The include path that worked:

    require_once(__DIR__ . '/../vendor/autoload.php');