Skip to content

Commit a32a8ad

Browse files
authored
Cleanup future canceled timer messages for redis backend
1 parent bfcf0c2 commit a32a8ad

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

backend/redis/events.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func addFutureEventP(ctx context.Context, p redis.Pipeliner, instance *core.Work
7070

7171
addFutureEventCmd.Run(
7272
ctx, p,
73-
[]string{futureEventsKey(), futureEventKey(instance.InstanceID, event.ID)},
73+
[]string{futureEventsKey(), futureEventKey(instance.InstanceID, event.ScheduleEventID)},
7474
event.VisibleAt.Unix(),
7575
instance.InstanceID,
7676
string(eventData),
@@ -86,7 +86,8 @@ var removeFutureEventCmd = redis.NewScript(`
8686
return redis.call("DEL", KEYS[2])
8787
`)
8888

89+
// removeFutureEvent removes a scheduled future event for the given event. Events are associated via their ScheduleEventID
8990
func removeFutureEventP(ctx context.Context, p redis.Pipeliner, instance *core.WorkflowInstance, event *history.Event) {
90-
key := futureEventKey(instance.InstanceID, event.ID)
91+
key := futureEventKey(instance.InstanceID, event.ScheduleEventID)
9192
removeFutureEventCmd.Run(ctx, p, []string{futureEventsKey(), key})
9293
}

backend/redis/keys.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ func futureEventsKey() string {
2424
return "future-events"
2525
}
2626

27-
func futureEventKey(instanceID, eventID string) string {
28-
return fmt.Sprintf("future-event:%v:%v", instanceID, eventID)
27+
func futureEventKey(instanceID string, scheduleEventID int64) string {
28+
return fmt.Sprintf("future-event:%v:%v", instanceID, scheduleEventID)
2929
}

0 commit comments

Comments
 (0)