Skip to content

Skip the beacon schedule when the beacon is disabled - #487

Open
soymgomez wants to merge 1 commit into
cachethq:mainfrom
soymgomez:skip-disabled-beacon-schedule
Open

soymgomez wants to merge 1 commit into
cachethq:mainfrom
soymgomez:skip-disabled-beacon-schedule

Conversation

@soymgomez

Copy link
Copy Markdown
Contributor

Summary

  • with CACHET_BEACON=false, the scheduler logs an error every day:

    Scheduled command ['/usr/bin/php8.4' 'artisan' cachet:beacon] failed with exit code [1].

  • cachet:beacon deliberately returns 1 when the beacon is disabled (covered by SendBeaconCommandTest), but the scheduled event runs regardless of the setting, and the scheduler treats a non-zero exit code as a failure
  • only run the scheduled event when cachet.beacon is enabled, using ->when() like the demo mode seeders below it. The command and its exit code are unchanged, and the event is still registered, so registers the package schedules by default keeps passing
  • add a test asserting that the beacon event's filters pass only when the beacon is enabled

Validation

  • the new test fails on main for the disabled case and passes with the fix
  • vendor/bin/pest: 1151 passed (4292 assertions)
  • vendor/bin/pint --test: passed
  • vendor/bin/phpstan analyse src/CachetCoreServiceProvider.php: no errors

The cachet:beacon command exits with code 1 when the beacon is disabled, and the scheduler logs every non-zero exit as an error. With CACHET_BEACON=false, every installation got a "Scheduled command [...] cachet:beacon failed with exit code [1]" error in its log each day. Only run the scheduled event when the beacon is enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant