panel icon indicating copy to clipboard operation
panel copied to clipboard

Refactor Node Stats

Open notAreYouScared opened this issue 9 months ago • 4 comments

They've been problematic from day one... no need to make them a scheduled job

notAreYouScared avatar Mar 21 '25 22:03 notAreYouScared

I agree that it's not a great solution, but we can't poll every single second either, that's even worse.

lancepioch avatar Mar 22 '25 04:03 lancepioch

I agree that it's not a great solution, but we can't poll every single second either, that's even worse.

How is 1 second worse than a webhook doing it every second? This isn't a job that runs and only runs on page view.

notAreYouScared avatar Mar 22 '25 09:03 notAreYouScared

  1. Keep the Job class
  2. Refactor Job so it's one Node per Job
  3. Use the below middleware sample code to lock unique jobs
  4. Keep the stats refreshing every 5 seconds but with the Job class
/**
 * Get the middleware the job should pass through.
 *
 * @return array<int, object>
 */
public function middleware(): array
{
    return [(new WithoutOverlapping($this->order->id))->dontRelease()];
}

lancepioch avatar Mar 27 '25 13:03 lancepioch

I still feel we should poll when they're viewing the page.... What's the point of being able to view the last 30 or whatever seconds before you view the page?

notAreYouScared avatar May 03 '25 15:05 notAreYouScared