- Issue created by @BramDriesen
- ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
Drafted first list of codes to handle
- First commit to issue fork.
- ๐ง๐ชBelgium dave.mentens
dave.mentens โ made their first commit to this issueโs fork.
- ๐ง๐ชBelgium dave.mentens
Added missing dependencies for 1.0.x patch
- Status changed to Needs review
about 1 year ago 5:43pm 29 September 2023 - @apaderno opened merge request.
- Status changed to Needs work
about 1 year ago 7:45am 30 September 2023 - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
The issue fork is 10 commits behind, 20 commits ahead of the upstream repository. When I created the MR, it created it against the 1.0.x branch, not the 2.0.x branch.
The
GraphService
class should have a different name, as none of the classes that implement a service contains Service in their names. - ๐ง๐ชBelgium cgoffin
I think it is also better to catch all exceptions thrown, because we now sometimes see a '503 Service Unavailable'.
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
The MR is also doing changes that should be better split on different issues, as they are not strictly necessary to implement a queue mechanism, for example adding the schema for the configuration file.
- @cgoffin opened merge request.
- @cgoffin opened merge request.
- ๐ง๐ชBelgium cgoffin
I tried to refactor, but also messed up some branches. My apologies. I created the new branch 3390319-add_queue_mechanism which started from the 1.0.x version. Here also a patch file to use in your projects.
- Status changed to Postponed
about 1 year ago 11:24am 12 October 2023 - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
It is better to postpone this, as the changes introduced from the linked issue are slightly different, even if the module will still implement a service class.
- Assigned to apaderno
- Status changed to Active
about 1 year ago 9:35am 13 October 2023 - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
I will handle this in the next 6 hours.
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
The issue I see is that the queue we require needs to be strictly first in, last out; it should also allow us to always handle items respecting the Retry-After value returned from the Microsoft Graph API. This is not possible with the queue API, which does not even guarantee the default queue is delayable.
- ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
first in, last out
Hmm I'm not following here. Why would that be needed? Seems more logical to me that the oldest item get's processed first.
Retry-After value returned from the Microsoft Graph API. This is not possible with the queue API, which does not even guarantee the default queue is delayable.
I don't really see an issue here. I guess we could set the delay exception to the retry-after value. But in anyway, the queue is depending on how often you're running cron, and thus processing queue's.
We're running on Acquia where the max cron interval is 5 minutes, so we know it is possible there might be a small delay in the emails being sent. However the trade off of having the email sent VS it being lost forever because there was an exception is for us a major reason to have the queue. We've been running this for a week or so now in production and everything is working fine actually.
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
The issue is that the queue API does not guarantee the implemented queue is reliable (the order of items is preserved and every item will be executed at least once) nor delayable (an item can be released on a delay) which are the requisites for the queue the module should use.
Furthermore, for the queue API, keeping an item in the queue is an exception, not the rule. The module needs also to get from the queue only those items for which the Retry-After delay is already passed.
I did not say the module will not use any queue, but that queue cannot be the queue implemented by the queue API.
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
We've been running this for a week or so now in production and everything is working fine actually.
It works fine only if the site is using the
DatabaseQueue
class for queues, but the default queue class can be changed by modules or from site settings, and the used class is not required to implementDelayableQueueInterface
norReliableQueueInterface
. - Status changed to Needs work
about 1 year ago 2:33pm 13 October 2023 - ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
Ah I see, we're not using
DelayedRequeueException
here - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
By default, cron tasks use the queue.database service, which implements a reliable and delayable queue.
If the site setting select a different queue, which is neither reliable nor delayable, that is an issue with the site settings, not the module. (As far as I can see, modules do not have a way to select a different queue implementation to pass to a QueueWorker plugin.)There are still issues with the current patch:
- The correct way to delay an item is to throw a
DelayedRequeueException
exception - The code checking for the Retry-Delay value does not verify the thrown exception type (
$delay = ($e->getResponse() && $e->getResponse()->hasHeader('Retry-After')) ? (int) $e->getResponse()->getHeader('Retry-After')[0] : 600;
)
For the first point, the only way to delay an item is to store in the item itself the delay the Microsoft Graph API required when throwing the exception. When the queue worker handles the item, it must first check the delay and be sure that delay is already passed, before handling the item.
- The correct way to delay an item is to throw a
-
apaderno โ
committed 327137de on 2.0.x authored by
cgoffin โ
Issue #3390319 by cgoffin, dave.mentens, apaderno: Implement a queue...
-
apaderno โ
committed 327137de on 2.0.x authored by
cgoffin โ
- Status changed to Active
about 1 year ago 8:06am 17 October 2023 - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
Now the code just needs to back-ported to the 1.0.x branch.
- Status changed to Fixed
about 1 year ago 8:46am 17 October 2023 Automatically closed - issue fixed for 2 weeks with no activity.