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

Snapshot miss lock time to time #935

Closed
glamorous opened this issue Nov 26, 2020 · 1 comment
Closed

Snapshot miss lock time to time #935

glamorous opened this issue Nov 26, 2020 · 1 comment

Comments

@glamorous
Copy link
Contributor

glamorous commented Nov 26, 2020

  • Horizon Version: 5.x
  • Laravel Version: 8.x
  • PHP Version: 7.4
  • Redis Driver & Version: predis/phpredis #.#.#

Description:

Because the cache-lock for metrics is exact 5minutes or 300s you can have cases when cron is running slow/fast, he can't obtain the lock and misses the snapshot for that timing.

Steps To Reproduce:

Having fast or slow environment.

Problem lays here:

/**
     * Execute the console command.
     *
     * @param  \Laravel\Horizon\Lock  $lock
     * @param  \Laravel\Horizon\Contracts\MetricsRepository  $metrics
     * @return void
     */
    public function handle(Lock $lock, MetricsRepository $metrics)
    {
        if ($lock->get('metrics:snapshot', 300)) {
            $metrics->snapshot();

            $this->info('Metrics snapshot stored successfully.');
        }

Proposal is to have this a couple of seconds lower or make it configurable so people can choose to have shapshots every 2 minutes for example.

@driesvints
Copy link
Member

Sure, feel free to send in a PR.

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

No branches or pull requests

2 participants