mirror of
https://github.com/juanfont/headscale.git
synced 2026-10-03 13:23:36 +09:00
mapper: drop empty changes before fan-out
An empty change carries no work for any recipient, so it never becomes
a pending entry. Adds headscale_mapper_changes_dropped_total.
Updates #3417
(cherry picked from commit 286f1d5a12)
This commit is contained in:
@@ -177,6 +177,11 @@ func (r Change) IsFull() bool {
|
||||
// This provides a bounded set of values suitable for Prometheus labels,
|
||||
// unlike [Change.Reason] which is free-form text for logging.
|
||||
func (r Change) Type() string {
|
||||
// A suppressed update is a healthy outcome, not an unclassified one.
|
||||
if r.IsEmpty() {
|
||||
return "empty"
|
||||
}
|
||||
|
||||
if r.IsFull() {
|
||||
return "full"
|
||||
}
|
||||
|
||||
@@ -561,9 +561,9 @@ func TestChange_Type(t *testing.T) {
|
||||
want: "ping",
|
||||
},
|
||||
{
|
||||
name: "empty is unknown",
|
||||
name: "empty",
|
||||
response: Change{},
|
||||
want: "unknown",
|
||||
want: "empty",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user