[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:
dependency
is depended upon by MGNLEE-729 Include webhooks module in DXcore st... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLHOOK-275 Implementation Sub-task Completed Robert Šiška  
MGNLHOOK-276 Review Sub-task Completed Javier Benito  
MGNLHOOK-277 Pre-Integration QA Sub-task Completed Javier Benito  
MGNLHOOK-278 QA Sub-task Completed Javier Benito  
Team: DeveloperX
Date of First Response:
Epic Link: Webhooks Maintenance (Phase 1)
Sprint: DevX 23
Story Points: 3

 Description   

Steps to reproduce

  1. Start a webapp (no matter if is DX Core or Cloud) with webhooks included
  2. Stop it

Actual result

Webhooks module stops after 20 seconds, because of this

Desired result

Webhooks 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 Input

When 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.

Generated at Mon Feb 12 10:02:33 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.