MCPcopy
hub / github.com/PatchMon/PatchMon / cancelKeyForEvent

Function cancelKeyForEvent

server-source-code/internal/notifications/emitter.go:438–452  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
438func 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.
455func delayedCancelKey(ev Event) string {

Callers 1

emitMethod · 0.85

Calls 1

metadataStringFunction · 0.85

Tested by

no test coverage detected