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

[4.x]: Queue progress not showing in _existing_ windows - must open a new window/tab to see it. #13990

Closed
bossanova808 opened this issue Dec 5, 2023 · 6 comments
Assignees

Comments

@bossanova808
Copy link

What happened?

Description

We're using a bunch of longer running queue jobs (~1 to 10 minutes). The jobs themselves seem to be working fine, and if I open a new window/tab after trggering the queue job, I can see the queue updates in the lower LHS of the control panel as expected

However, these updates never appear in any existing, open window without a full page reload.

I wonder if this change is quite correct?
#10632

I guess the question is should I see the updates in the existing window? Because it would certainly be much more useful to see those updates in the window I've triggered the job from.

Steps to reproduce

  1. Trigger a ,long running queue job in one window
  2. Wait, & never see any progress updates in this window
  3. Open another window - all progress updates appear as expected

Expected behavior

See queue updates in all windows, including existing ones.

Actual behavior

See above.

Craft CMS version

Craft CMS Pro 4.5.11.1

PHP version

8.2

Operating system and version

Ubuntu 22.04 (Forge)

Database type and version

MySQL 8.0.35

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

Not relevant here

@brandonkelly
Copy link
Member

The only times Craft polls/displays job info is when there were pending/active jobs in the queue on initial page load, or after some Ajax requests where it’s likely that a job would have been queued up. It won’t randomly check for new jobs once the queue is empty.

That said, I realized I can have tabs notify other tabs about job updates via a broadcast channel, without any additional Ajax requests. So I’ve just made that change for the next release. Now whichever browser tab has focus will act as the main job poller, and will push out job info to the other tabs.

@brandonkelly
Copy link
Member

Craft 4.5.12 is out with that change!

@bossanova808
Copy link
Author

Thanks - sounds like a useful improvement, but this doesn't really address the actual issue does it? I.e. I use a button to trigger a queue job, but I then don't seen any updates in that window if I just leave it open and wait - I still have to reload. That's the basic issue I'd like to get solved.

But I suppose that is not easily solvable unless either the CP starts to poll at all times, or if Craft had some sort of SSE/websockets type notification system (which would be hugely useful in all sorts of contexts....)

@brandonkelly
Copy link
Member

Is this button something you added yourself somewhere? If so, just add a call to Craft.cp.trackJobProgress() after the job is queued up.

@bossanova808
Copy link
Author

bossanova808 commented Dec 15, 2023

It is (some sprig enabled buttons on a control panel page to trigger various third party API thing)...and that's exactly the little bit of (undocumented?) magic I need - thanks Brandon!

(is there anywhere the CP JS stuff is documented that I am missing?)

@brandonkelly
Copy link
Member

Very little is documented currently. We’re working to improve that in time for Craft 6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants