Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: breacrumbs in tasks (useful for reactive execution time methods) #4

Open
tomloprod opened this issue May 20, 2024 · 0 comments
Labels
idea Represents an idea for a potential development

Comments

@tomloprod
Copy link
Owner

tomloprod commented May 20, 2024

Create a "breadcrumbs" system in tasks. This system would allow us to add informative data to tasks to be used in the reactive execution time methods.

Example:

TimeWarden::task('Articles')->start();

foreach ($articles as $article) {
    // ...
    TimeWarden::leaveBreadcrumb(
        'message', // breadcrumb message
        Breadcrumb::TYPE, // breadcrumb type (enum)
        ['foo' => 'bar'] // custom metadata
    );
}

TimeWarden::stop(static function (Task $task): void {
    $task->onExceedsMinutes(10, static function (Task $task): void {
        // Do something with $task and $task->getLastBreadcrumbs()
    });
});
@tomloprod tomloprod added the idea Represents an idea for a potential development label May 20, 2024
@tomloprod tomloprod changed the title Feature: Breacrumbs in tasks (useful for reactive execution time methods) Feature: breacrumbs in tasks (useful for reactive execution time methods) May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Represents an idea for a potential development
Projects
None yet
Development

No branches or pull requests

1 participant