[MGNLHOOK-260] Improve Webhooks stop time Created: 20/Oct/22 Updated: 11/Nov/22 Resolved: 11/Nov/22 |
|
| Status: | Closed |
| Project: | Magnolia Webhooks |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.0.0, 1.0.1 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Javier Benito | Assignee: | Robert Šiška |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Σ Remaining Estimate: | Not Specified | Remaining Estimate: | Not Specified |
| Σ Time Spent: | Not Specified | Time Spent: | Not Specified |
| Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
| Issue Links: |
|
|||||||||||||||||||||||||
| Sub-Tasks: |
|
|||||||||||||||||||||||||
| Team: | ||||||||||||||||||||||||||
| Date of First Response: | ||||||||||||||||||||||||||
| Epic Link: | Webhooks Maintenance (Phase 1) | |||||||||||||||||||||||||
| Sprint: | DevX 23 | |||||||||||||||||||||||||
| Story Points: | 3 | |||||||||||||||||||||||||
| Description |
Steps to reproduce
Actual resultWebhooks module stops after 20 seconds, because of this Desired resultWebhooks module could stop quicker, reducing the courtesy time for the threads to stop gracefully. It can even be somehow configurable to shorten webapp reboot time during development. PM InputWhen Magnolia gets a command to shutdown, it should do so immedeatly, regardless of any webhooks or REST request "in progress". If there is a shutdown it is not expected that any in-progress requests succeed. Magnoila should shutdown right away so that it can cleanly and quickly be restarted shortly after shutting down.
|
| Comments |
| Comment by Christopher Zimmermann [ 20/Oct/22 ] |
|
What are the performance implications of reducing it - for example to 2 or 1 second? |
| Comment by Javier Benito [ 20/Oct/22 ] |
|
Webhooks logic works with a thread pool (workers) that takes events from the queue and dispatches them. Currently, those 20 seconds we're waiting during Magnolia instance shutdown, are the courtesy time we give those threads to finish what they're doing (maybe sending an HTTP request to an external endpoint), before just killing them, to let the JVM stop. So it doesn't have any performance implications regarding a normal webhook event processing flow. It's only taken into account when the instance is going to be shut down. Just in case there would be lots of events in the queue waiting to be processed, we'd lose those which are not taken within those 20 seconds (or 2, if we reduce it). But as far as we still don't have a way to persist pending events when an instance is shutdown, to be processed after the instance startup, I'd say we're already assuming that we can lose some events in this case. |