Skip to content

Ensure Idempotency in A_TO_RecycleTripDriver Function #109

Open
@NullPointer4096

Description

@NullPointer4096

Description:
The A_TO_RecycleTripDriver function in the TripMonitorOrchestrator does not currently handle idempotency. This can lead to processing the same event multiple times, which may cause unwanted side effects, such as incorrect driver status updates. To address this issue, we need to store a unique identifier for each trip's recycling event in a persistent storage and ensure that each event is processed only once.

Steps to reproduce:

  1. Run the TripMonitorOrchestrator.
  2. Simulate an error exit after the ServiceFactory.GetLoggerService().Log api but before the function completes
  3. Trigger the A_TO_RecycleTripDriver function through by invoking the orchestrator. Let the first run fail.
  4. Let the function retry automatically.

Expected behavior:
The A_TO_RecycleTripDriver function should process the trip recycling event only once and skip any subsequent calls with the same trip.

Actual behavior:
The A_TO_RecycleTripDriver function will invoke the ServiceFactory.GetLoggerService().Log api more than once on error exit. Thus, there will be duplicated messages.

Proposed Solution:
We should have the front end deduplicate the recycling event for the trip has already been processed. This can be done by maintaining the last processed id in some queryable storage or memory. If the event id matches the last processed id. skip the processing to maintain idempotency.

Thank you for your contribution to the Github community and I really appreciate your effort in following through this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions