-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent relative expiry from emitting more events than can be process…
…ed (#12002) * Prevent relative expiry from emitting more events than can be processed This alters relative expiry in four ways: 1) Relative expiry is no longer exclusively run by the auth cache 2) Relative expiry no longer emits delete events 3) There is now a limit to the number of nodes removed per interval 4) Relative expiry now runs more frequently We can remove the need to emit any fake delete events during relative expiry by not running it exclusively in the auth cache. All caches will now run relative expiry themselves, even the components that don't watch for nodes - this is effectively a noop for them. To prevent the individual caches from getting too far out of sync, the expiry interval is set to a much smaller value and we limit the number of nodes being deleted per interval. (cherry picked from commit b8394b3)
1 parent
d89371c
commit fe06101
Showing
4 changed files
with
200 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2022 Gravitational, Inc | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package interval | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestNewNoop(t *testing.T) { | ||
i := NewNoop() | ||
ch := i.Next() | ||
select { | ||
case <-ch: | ||
t.Fatalf("noop should not emit anything") | ||
default: | ||
} | ||
i.Stop() | ||
select { | ||
case <-ch: | ||
t.Fatalf("noop should not emit anything") | ||
default: | ||
} | ||
} |