itsgoingd / itsgoingd/clockwork

On Demand not working with Laravel Octane

Open
#592 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
6k
Forks
333
Avg merge
5m
Merged PRs (30d)
1

Description

When running with a configured on demand key no requests are captured.

My investigation shows that this is caused because the service provider is only booted on startup of Octane and the event listeners and middleware are not registered.

https://github.com/itsgoingd/clockwork/blob/bd13e765a6d77d95a6d6ecf9842a7d02382ff39d/Clockwork/Support/Laravel/ClockworkServiceProvider.php#L27-L30
Line 27 will evaluate to false.

Analysis

When the Octane server boots up and registers the service providers and a new empty request is created in the support class.

https://github.com/itsgoingd/clockwork/blob/bd13e765a6d77d95a6d6ecf9842a7d02382ff39d/Clockwork/Support/Laravel/ClockworkSupport.php#L661-L672

This empty request does not contain the on demand key and thus will fail the shouldCollect() call on Line 54

https://github.com/itsgoingd/clockwork/blob/bd13e765a6d77d95a6d6ecf9842a7d02382ff39d/Clockwork/Support/Laravel/ClockworkSupport.php#L549-L555

The end result is that the middleware and event listeners are not registered.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Clockwork/Support/Laravel/ClockworkServiceProvider.php around lines 27-30 and trace how Octane startup reaches Clockwork/Support/Laravel/ClockworkSupport.php around lines 549-555 and 661-672. Reproduce the configured on-demand-key case under Laravel Octane and verify that middleware and event listeners are registered and requests are captured when the key is present.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
backend, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.