| 1 | package extension |
| 2 | |
| 3 | // StaleGeneration reports whether a message generation is older than the |
| 4 | // currently published runtime generation and must be silently dropped. |
| 5 | // Equal or newer generations are not stale: mid-activation UI/stream traffic |
| 6 | // for the generation about to be published must still be accepted. |
| 7 | func StaleGeneration(messageGen, publishedGen uint64) bool { |
| 8 | return messageGen != 0 && publishedGen != 0 && messageGen < publishedGen |
| 9 | } |
| 10 | |
| 11 | // StaleEpoch reports whether a message epoch no longer matches the published |
| 12 | // component epoch. |
| 13 | func StaleEpoch(messageEpoch, publishedEpoch string) bool { |
| 14 | if messageEpoch == "" || publishedEpoch == "" { |
| 15 | return false |
| 16 | } |
| 17 | return messageEpoch != publishedEpoch |
| 18 | } |
| 19 |