cancelKeyForEvent returns the Redis cancel key to set when this event fires, suppressing a delayed counterpart. Returns "" if this event doesn't cancel anything.
(ev Event)
| 436 | // cancelKeyForEvent returns the Redis cancel key to set when this event fires, |
| 437 | // suppressing a delayed counterpart. Returns "" if this event doesn't cancel anything. |
| 438 | func cancelKeyForEvent(ev Event) string { |
| 439 | target, ok := cancelPairs[ev.Type] |
| 440 | if !ok { |
| 441 | return "" |
| 442 | } |
| 443 | // Use reference_id (host ID) to scope cancellation to the specific resource. |
| 444 | refID := ev.ReferenceID |
| 445 | if refID == "" { |
| 446 | refID = metadataString(ev.Metadata, "host_id") |
| 447 | } |
| 448 | if refID == "" { |
| 449 | return "" |
| 450 | } |
| 451 | return fmt.Sprintf("notif:cancel:%s:%s", target, refID) |
| 452 | } |
| 453 | |
| 454 | // delayedCancelKey returns the Redis key that, if set, means this delayed notification should be suppressed. |
| 455 | func delayedCancelKey(ev Event) string { |