Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Logger Rate Limiter
Bookmark
Input
Standard
All Unique
Rapid Same Message
Custom
operations
=
[{"timestamp":1,"message":"foo"},{"timestamp":2,"message":"bar"},{"timestamp":3,"message":"foo"},{"timestamp":8,"message":"bar"},{"timestamp":10,"message":"foo"},{"timestamp":11,"message":"foo"}]
printed =
0
blocked =
0
t
1
2
3
8
10
11
foo
bar
foo
bar
foo
foo
time
0
5
10
15
20
map
empty
algo
master
.
io
Step:
Start: track each message's nextAllowed time in a hash map. A message may print again only when timestamp >= nextAllowed.
0 / 13
Input
Standard
All Unique
Rapid Same Message
Custom
operations
=
[{"timestamp":1,"message":"foo"},{"timestamp":2,"message":"bar"},{"timestamp":3,"message":"foo"},{"timestamp":8,"message":"bar"},{"timestamp":10,"message":"foo"},{"timestamp":11,"message":"foo"}]
0 / 13
printed =
0
blocked =
0
t
1
2
3
8
10
11
foo
bar
foo
bar
foo
foo
time
0
5
10
15
20
map
empty
algo
master
.
io
Step:
Start: track each message's nextAllowed time in a hash map. A message may print again only when timestamp >= nextAllowed.