-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance housekeeping to add variety of tasks #932
Conversation
WalkthroughThe changes enhance the Yorkie backend by restructuring the housekeeping functionalities, optimizing the management of inactive clients, and improving dependency management. A new caching mechanism for webhooks has been introduced, along with refined testing capabilities. These updates collectively streamline the backend processes, provide better resource management, and facilitate the integration of scheduled tasks while ensuring code clarity and maintainability. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Backend
participant Housekeeping
Client->>Backend: Initialize Backend
Backend->>Backend: Setup AuthWebhookCache
Backend->>Housekeeping: Start housekeeping tasks
Housekeeping->>Housekeeping: Schedule deactivation tasks
Housekeeping->>Client: Deactivate inactive clients
Note right of Client: Clients are deactivated based on criteria
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go Benchmark
Benchmark suite | Current: 55bdb4d | Previous: 5652af0 | Ratio |
---|---|---|---|
BenchmarkDocument/constructor_test |
1503 ns/op 1337 B/op 24 allocs/op |
1482 ns/op 1337 B/op 24 allocs/op |
1.01 |
BenchmarkDocument/constructor_test - ns/op |
1503 ns/op |
1482 ns/op |
1.01 |
BenchmarkDocument/constructor_test - B/op |
1337 B/op |
1337 B/op |
1 |
BenchmarkDocument/constructor_test - allocs/op |
24 allocs/op |
24 allocs/op |
1 |
BenchmarkDocument/status_test |
967.9 ns/op 1305 B/op 22 allocs/op |
982.3 ns/op 1305 B/op 22 allocs/op |
0.99 |
BenchmarkDocument/status_test - ns/op |
967.9 ns/op |
982.3 ns/op |
0.99 |
BenchmarkDocument/status_test - B/op |
1305 B/op |
1305 B/op |
1 |
BenchmarkDocument/status_test - allocs/op |
22 allocs/op |
22 allocs/op |
1 |
BenchmarkDocument/equals_test |
7608 ns/op 7273 B/op 132 allocs/op |
7617 ns/op 7273 B/op 132 allocs/op |
1.00 |
BenchmarkDocument/equals_test - ns/op |
7608 ns/op |
7617 ns/op |
1.00 |
BenchmarkDocument/equals_test - B/op |
7273 B/op |
7273 B/op |
1 |
BenchmarkDocument/equals_test - allocs/op |
132 allocs/op |
132 allocs/op |
1 |
BenchmarkDocument/nested_update_test |
16868 ns/op 12139 B/op 262 allocs/op |
16852 ns/op 12138 B/op 262 allocs/op |
1.00 |
BenchmarkDocument/nested_update_test - ns/op |
16868 ns/op |
16852 ns/op |
1.00 |
BenchmarkDocument/nested_update_test - B/op |
12139 B/op |
12138 B/op |
1.00 |
BenchmarkDocument/nested_update_test - allocs/op |
262 allocs/op |
262 allocs/op |
1 |
BenchmarkDocument/delete_test |
26063 ns/op 15363 B/op 341 allocs/op |
23377 ns/op 15363 B/op 341 allocs/op |
1.11 |
BenchmarkDocument/delete_test - ns/op |
26063 ns/op |
23377 ns/op |
1.11 |
BenchmarkDocument/delete_test - B/op |
15363 B/op |
15363 B/op |
1 |
BenchmarkDocument/delete_test - allocs/op |
341 allocs/op |
341 allocs/op |
1 |
BenchmarkDocument/object_test |
8612 ns/op 6817 B/op 120 allocs/op |
9808 ns/op 6817 B/op 120 allocs/op |
0.88 |
BenchmarkDocument/object_test - ns/op |
8612 ns/op |
9808 ns/op |
0.88 |
BenchmarkDocument/object_test - B/op |
6817 B/op |
6817 B/op |
1 |
BenchmarkDocument/object_test - allocs/op |
120 allocs/op |
120 allocs/op |
1 |
BenchmarkDocument/array_test |
28999 ns/op 11946 B/op 276 allocs/op |
29348 ns/op 11947 B/op 276 allocs/op |
0.99 |
BenchmarkDocument/array_test - ns/op |
28999 ns/op |
29348 ns/op |
0.99 |
BenchmarkDocument/array_test - B/op |
11946 B/op |
11947 B/op |
1.00 |
BenchmarkDocument/array_test - allocs/op |
276 allocs/op |
276 allocs/op |
1 |
BenchmarkDocument/text_test |
30512 ns/op 14715 B/op 469 allocs/op |
30751 ns/op 14716 B/op 469 allocs/op |
0.99 |
BenchmarkDocument/text_test - ns/op |
30512 ns/op |
30751 ns/op |
0.99 |
BenchmarkDocument/text_test - B/op |
14715 B/op |
14716 B/op |
1.00 |
BenchmarkDocument/text_test - allocs/op |
469 allocs/op |
469 allocs/op |
1 |
BenchmarkDocument/text_composition_test |
28822 ns/op 18420 B/op 484 allocs/op |
28929 ns/op 18422 B/op 484 allocs/op |
1.00 |
BenchmarkDocument/text_composition_test - ns/op |
28822 ns/op |
28929 ns/op |
1.00 |
BenchmarkDocument/text_composition_test - B/op |
18420 B/op |
18422 B/op |
1.00 |
BenchmarkDocument/text_composition_test - allocs/op |
484 allocs/op |
484 allocs/op |
1 |
BenchmarkDocument/rich_text_test |
80415 ns/op 38476 B/op 1148 allocs/op |
80936 ns/op 38476 B/op 1148 allocs/op |
0.99 |
BenchmarkDocument/rich_text_test - ns/op |
80415 ns/op |
80936 ns/op |
0.99 |
BenchmarkDocument/rich_text_test - B/op |
38476 B/op |
38476 B/op |
1 |
BenchmarkDocument/rich_text_test - allocs/op |
1148 allocs/op |
1148 allocs/op |
1 |
BenchmarkDocument/counter_test |
17421 ns/op 10722 B/op 244 allocs/op |
17432 ns/op 10722 B/op 244 allocs/op |
1.00 |
BenchmarkDocument/counter_test - ns/op |
17421 ns/op |
17432 ns/op |
1.00 |
BenchmarkDocument/counter_test - B/op |
10722 B/op |
10722 B/op |
1 |
BenchmarkDocument/counter_test - allocs/op |
244 allocs/op |
244 allocs/op |
1 |
BenchmarkDocument/text_edit_gc_100 |
1287593 ns/op 870944 B/op 16753 allocs/op |
1290553 ns/op 870962 B/op 16752 allocs/op |
1.00 |
BenchmarkDocument/text_edit_gc_100 - ns/op |
1287593 ns/op |
1290553 ns/op |
1.00 |
BenchmarkDocument/text_edit_gc_100 - B/op |
870944 B/op |
870962 B/op |
1.00 |
BenchmarkDocument/text_edit_gc_100 - allocs/op |
16753 allocs/op |
16752 allocs/op |
1.00 |
BenchmarkDocument/text_edit_gc_1000 |
49833730 ns/op 50536566 B/op 181713 allocs/op |
50652893 ns/op 50536122 B/op 181705 allocs/op |
0.98 |
BenchmarkDocument/text_edit_gc_1000 - ns/op |
49833730 ns/op |
50652893 ns/op |
0.98 |
BenchmarkDocument/text_edit_gc_1000 - B/op |
50536566 B/op |
50536122 B/op |
1.00 |
BenchmarkDocument/text_edit_gc_1000 - allocs/op |
181713 allocs/op |
181705 allocs/op |
1.00 |
BenchmarkDocument/text_split_gc_100 |
1854456 ns/op 1528840 B/op 15604 allocs/op |
1879797 ns/op 1528818 B/op 15605 allocs/op |
0.99 |
BenchmarkDocument/text_split_gc_100 - ns/op |
1854456 ns/op |
1879797 ns/op |
0.99 |
BenchmarkDocument/text_split_gc_100 - B/op |
1528840 B/op |
1528818 B/op |
1.00 |
BenchmarkDocument/text_split_gc_100 - allocs/op |
15604 allocs/op |
15605 allocs/op |
1.00 |
BenchmarkDocument/text_split_gc_1000 |
110386288 ns/op 135079872 B/op 182217 allocs/op |
110542057 ns/op 135077744 B/op 182188 allocs/op |
1.00 |
BenchmarkDocument/text_split_gc_1000 - ns/op |
110386288 ns/op |
110542057 ns/op |
1.00 |
BenchmarkDocument/text_split_gc_1000 - B/op |
135079872 B/op |
135077744 B/op |
1.00 |
BenchmarkDocument/text_split_gc_1000 - allocs/op |
182217 allocs/op |
182188 allocs/op |
1.00 |
BenchmarkDocument/text_delete_all_10000 |
15593036 ns/op 10181945 B/op 40671 allocs/op |
16449907 ns/op 10185259 B/op 40675 allocs/op |
0.95 |
BenchmarkDocument/text_delete_all_10000 - ns/op |
15593036 ns/op |
16449907 ns/op |
0.95 |
BenchmarkDocument/text_delete_all_10000 - B/op |
10181945 B/op |
10185259 B/op |
1.00 |
BenchmarkDocument/text_delete_all_10000 - allocs/op |
40671 allocs/op |
40675 allocs/op |
1.00 |
BenchmarkDocument/text_delete_all_100000 |
294122968 ns/op 142663800 B/op 411663 allocs/op |
298935278 ns/op 142700664 B/op 411766 allocs/op |
0.98 |
BenchmarkDocument/text_delete_all_100000 - ns/op |
294122968 ns/op |
298935278 ns/op |
0.98 |
BenchmarkDocument/text_delete_all_100000 - B/op |
142663800 B/op |
142700664 B/op |
1.00 |
BenchmarkDocument/text_delete_all_100000 - allocs/op |
411663 allocs/op |
411766 allocs/op |
1.00 |
BenchmarkDocument/text_100 |
222193 ns/op 120035 B/op 5081 allocs/op |
214594 ns/op 120035 B/op 5081 allocs/op |
1.04 |
BenchmarkDocument/text_100 - ns/op |
222193 ns/op |
214594 ns/op |
1.04 |
BenchmarkDocument/text_100 - B/op |
120035 B/op |
120035 B/op |
1 |
BenchmarkDocument/text_100 - allocs/op |
5081 allocs/op |
5081 allocs/op |
1 |
BenchmarkDocument/text_1000 |
2351970 ns/op 1169022 B/op 50085 allocs/op |
2343605 ns/op 1169022 B/op 50085 allocs/op |
1.00 |
BenchmarkDocument/text_1000 - ns/op |
2351970 ns/op |
2343605 ns/op |
1.00 |
BenchmarkDocument/text_1000 - B/op |
1169022 B/op |
1169022 B/op |
1 |
BenchmarkDocument/text_1000 - allocs/op |
50085 allocs/op |
50085 allocs/op |
1 |
BenchmarkDocument/array_1000 |
1230395 ns/op 1091408 B/op 11832 allocs/op |
1220428 ns/op 1091390 B/op 11831 allocs/op |
1.01 |
BenchmarkDocument/array_1000 - ns/op |
1230395 ns/op |
1220428 ns/op |
1.01 |
BenchmarkDocument/array_1000 - B/op |
1091408 B/op |
1091390 B/op |
1.00 |
BenchmarkDocument/array_1000 - allocs/op |
11832 allocs/op |
11831 allocs/op |
1.00 |
BenchmarkDocument/array_10000 |
13253848 ns/op 9801165 B/op 120301 allocs/op |
13486979 ns/op 9800259 B/op 120298 allocs/op |
0.98 |
BenchmarkDocument/array_10000 - ns/op |
13253848 ns/op |
13486979 ns/op |
0.98 |
BenchmarkDocument/array_10000 - B/op |
9801165 B/op |
9800259 B/op |
1.00 |
BenchmarkDocument/array_10000 - allocs/op |
120301 allocs/op |
120298 allocs/op |
1.00 |
BenchmarkDocument/array_gc_100 |
146534 ns/op 132713 B/op 1260 allocs/op |
148318 ns/op 132720 B/op 1260 allocs/op |
0.99 |
BenchmarkDocument/array_gc_100 - ns/op |
146534 ns/op |
148318 ns/op |
0.99 |
BenchmarkDocument/array_gc_100 - B/op |
132713 B/op |
132720 B/op |
1.00 |
BenchmarkDocument/array_gc_100 - allocs/op |
1260 allocs/op |
1260 allocs/op |
1 |
BenchmarkDocument/array_gc_1000 |
1380352 ns/op 1159100 B/op 12876 allocs/op |
1410958 ns/op 1159141 B/op 12876 allocs/op |
0.98 |
BenchmarkDocument/array_gc_1000 - ns/op |
1380352 ns/op |
1410958 ns/op |
0.98 |
BenchmarkDocument/array_gc_1000 - B/op |
1159100 B/op |
1159141 B/op |
1.00 |
BenchmarkDocument/array_gc_1000 - allocs/op |
12876 allocs/op |
12876 allocs/op |
1 |
BenchmarkDocument/counter_1000 |
198367 ns/op 193079 B/op 5771 allocs/op |
201475 ns/op 193081 B/op 5771 allocs/op |
0.98 |
BenchmarkDocument/counter_1000 - ns/op |
198367 ns/op |
201475 ns/op |
0.98 |
BenchmarkDocument/counter_1000 - B/op |
193079 B/op |
193081 B/op |
1.00 |
BenchmarkDocument/counter_1000 - allocs/op |
5771 allocs/op |
5771 allocs/op |
1 |
BenchmarkDocument/counter_10000 |
2161975 ns/op 2088011 B/op 59778 allocs/op |
2180342 ns/op 2087997 B/op 59778 allocs/op |
0.99 |
BenchmarkDocument/counter_10000 - ns/op |
2161975 ns/op |
2180342 ns/op |
0.99 |
BenchmarkDocument/counter_10000 - B/op |
2088011 B/op |
2087997 B/op |
1.00 |
BenchmarkDocument/counter_10000 - allocs/op |
59778 allocs/op |
59778 allocs/op |
1 |
BenchmarkDocument/object_1000 |
1377246 ns/op 1428127 B/op 9849 allocs/op |
1378520 ns/op 1428203 B/op 9849 allocs/op |
1.00 |
BenchmarkDocument/object_1000 - ns/op |
1377246 ns/op |
1378520 ns/op |
1.00 |
BenchmarkDocument/object_1000 - B/op |
1428127 B/op |
1428203 B/op |
1.00 |
BenchmarkDocument/object_1000 - allocs/op |
9849 allocs/op |
9849 allocs/op |
1 |
BenchmarkDocument/object_10000 |
15210454 ns/op 12166161 B/op 100561 allocs/op |
15413755 ns/op 12165891 B/op 100562 allocs/op |
0.99 |
BenchmarkDocument/object_10000 - ns/op |
15210454 ns/op |
15413755 ns/op |
0.99 |
BenchmarkDocument/object_10000 - B/op |
12166161 B/op |
12165891 B/op |
1.00 |
BenchmarkDocument/object_10000 - allocs/op |
100561 allocs/op |
100562 allocs/op |
1.00 |
BenchmarkDocument/tree_100 |
1013109 ns/op 943699 B/op 6101 allocs/op |
1071090 ns/op 943703 B/op 6101 allocs/op |
0.95 |
BenchmarkDocument/tree_100 - ns/op |
1013109 ns/op |
1071090 ns/op |
0.95 |
BenchmarkDocument/tree_100 - B/op |
943699 B/op |
943703 B/op |
1.00 |
BenchmarkDocument/tree_100 - allocs/op |
6101 allocs/op |
6101 allocs/op |
1 |
BenchmarkDocument/tree_1000 |
71858342 ns/op 86460222 B/op 60115 allocs/op |
78344045 ns/op 86460432 B/op 60114 allocs/op |
0.92 |
BenchmarkDocument/tree_1000 - ns/op |
71858342 ns/op |
78344045 ns/op |
0.92 |
BenchmarkDocument/tree_1000 - B/op |
86460222 B/op |
86460432 B/op |
1.00 |
BenchmarkDocument/tree_1000 - allocs/op |
60115 allocs/op |
60114 allocs/op |
1.00 |
BenchmarkDocument/tree_10000 |
9348506545 ns/op 8580664288 B/op 600236 allocs/op |
9803273378 ns/op 8580669280 B/op 600224 allocs/op |
0.95 |
BenchmarkDocument/tree_10000 - ns/op |
9348506545 ns/op |
9803273378 ns/op |
0.95 |
BenchmarkDocument/tree_10000 - B/op |
8580664288 B/op |
8580669280 B/op |
1.00 |
BenchmarkDocument/tree_10000 - allocs/op |
600236 allocs/op |
600224 allocs/op |
1.00 |
BenchmarkDocument/tree_delete_all_1000 |
77626023 ns/op 87510394 B/op 75267 allocs/op |
74666925 ns/op 87509894 B/op 75265 allocs/op |
1.04 |
BenchmarkDocument/tree_delete_all_1000 - ns/op |
77626023 ns/op |
74666925 ns/op |
1.04 |
BenchmarkDocument/tree_delete_all_1000 - B/op |
87510394 B/op |
87509894 B/op |
1.00 |
BenchmarkDocument/tree_delete_all_1000 - allocs/op |
75267 allocs/op |
75265 allocs/op |
1.00 |
BenchmarkDocument/tree_edit_gc_100 |
3689254 ns/op 4146630 B/op 15140 allocs/op |
3740585 ns/op 4147776 B/op 15140 allocs/op |
0.99 |
BenchmarkDocument/tree_edit_gc_100 - ns/op |
3689254 ns/op |
3740585 ns/op |
0.99 |
BenchmarkDocument/tree_edit_gc_100 - B/op |
4146630 B/op |
4147776 B/op |
1.00 |
BenchmarkDocument/tree_edit_gc_100 - allocs/op |
15140 allocs/op |
15140 allocs/op |
1 |
BenchmarkDocument/tree_edit_gc_1000 |
297161197 ns/op 383744604 B/op 154846 allocs/op |
302010191 ns/op 383745126 B/op 154848 allocs/op |
0.98 |
BenchmarkDocument/tree_edit_gc_1000 - ns/op |
297161197 ns/op |
302010191 ns/op |
0.98 |
BenchmarkDocument/tree_edit_gc_1000 - B/op |
383744604 B/op |
383745126 B/op |
1.00 |
BenchmarkDocument/tree_edit_gc_1000 - allocs/op |
154846 allocs/op |
154848 allocs/op |
1.00 |
BenchmarkDocument/tree_split_gc_100 |
2474669 ns/op 2412454 B/op 11125 allocs/op |
2488278 ns/op 2412476 B/op 11125 allocs/op |
0.99 |
BenchmarkDocument/tree_split_gc_100 - ns/op |
2474669 ns/op |
2488278 ns/op |
0.99 |
BenchmarkDocument/tree_split_gc_100 - B/op |
2412454 B/op |
2412476 B/op |
1.00 |
BenchmarkDocument/tree_split_gc_100 - allocs/op |
11125 allocs/op |
11125 allocs/op |
1 |
BenchmarkDocument/tree_split_gc_1000 |
178198347 ns/op 222253710 B/op 121997 allocs/op |
184013095 ns/op 222251300 B/op 121995 allocs/op |
0.97 |
BenchmarkDocument/tree_split_gc_1000 - ns/op |
178198347 ns/op |
184013095 ns/op |
0.97 |
BenchmarkDocument/tree_split_gc_1000 - B/op |
222253710 B/op |
222251300 B/op |
1.00 |
BenchmarkDocument/tree_split_gc_1000 - allocs/op |
121997 allocs/op |
121995 allocs/op |
1.00 |
BenchmarkRPC/client_to_server |
373772568 ns/op 16956469 B/op 175368 allocs/op |
384424668 ns/op 16964362 B/op 175381 allocs/op |
0.97 |
BenchmarkRPC/client_to_server - ns/op |
373772568 ns/op |
384424668 ns/op |
0.97 |
BenchmarkRPC/client_to_server - B/op |
16956469 B/op |
16964362 B/op |
1.00 |
BenchmarkRPC/client_to_server - allocs/op |
175368 allocs/op |
175381 allocs/op |
1.00 |
BenchmarkRPC/client_to_client_via_server |
628693531 ns/op 33465172 B/op 321060 allocs/op |
638701344 ns/op 33477112 B/op 320935 allocs/op |
0.98 |
BenchmarkRPC/client_to_client_via_server - ns/op |
628693531 ns/op |
638701344 ns/op |
0.98 |
BenchmarkRPC/client_to_client_via_server - B/op |
33465172 B/op |
33477112 B/op |
1.00 |
BenchmarkRPC/client_to_client_via_server - allocs/op |
321060 allocs/op |
320935 allocs/op |
1.00 |
BenchmarkRPC/attach_large_document |
1223778488 ns/op 1909369552 B/op 8873 allocs/op |
1251081232 ns/op 1896295608 B/op 8877 allocs/op |
0.98 |
BenchmarkRPC/attach_large_document - ns/op |
1223778488 ns/op |
1251081232 ns/op |
0.98 |
BenchmarkRPC/attach_large_document - B/op |
1909369552 B/op |
1896295608 B/op |
1.01 |
BenchmarkRPC/attach_large_document - allocs/op |
8873 allocs/op |
8877 allocs/op |
1.00 |
BenchmarkRPC/adminCli_to_server |
540894160 ns/op 36773196 B/op 289539 allocs/op |
556409160 ns/op 35951732 B/op 289524 allocs/op |
0.97 |
BenchmarkRPC/adminCli_to_server - ns/op |
540894160 ns/op |
556409160 ns/op |
0.97 |
BenchmarkRPC/adminCli_to_server - B/op |
36773196 B/op |
35951732 B/op |
1.02 |
BenchmarkRPC/adminCli_to_server - allocs/op |
289539 allocs/op |
289524 allocs/op |
1.00 |
BenchmarkLocker |
63.67 ns/op 16 B/op 1 allocs/op |
64.12 ns/op 16 B/op 1 allocs/op |
0.99 |
BenchmarkLocker - ns/op |
63.67 ns/op |
64.12 ns/op |
0.99 |
BenchmarkLocker - B/op |
16 B/op |
16 B/op |
1 |
BenchmarkLocker - allocs/op |
1 allocs/op |
1 allocs/op |
1 |
BenchmarkLockerParallel |
39.85 ns/op 0 B/op 0 allocs/op |
39.83 ns/op 0 B/op 0 allocs/op |
1.00 |
BenchmarkLockerParallel - ns/op |
39.85 ns/op |
39.83 ns/op |
1.00 |
BenchmarkLockerParallel - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkLockerParallel - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkLockerMoreKeys |
146.8 ns/op 15 B/op 0 allocs/op |
150.6 ns/op 15 B/op 0 allocs/op |
0.97 |
BenchmarkLockerMoreKeys - ns/op |
146.8 ns/op |
150.6 ns/op |
0.97 |
BenchmarkLockerMoreKeys - B/op |
15 B/op |
15 B/op |
1 |
BenchmarkLockerMoreKeys - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkChange/Push_10_Changes |
3869341 ns/op 121627 B/op 1284 allocs/op |
3954977 ns/op 121234 B/op 1284 allocs/op |
0.98 |
BenchmarkChange/Push_10_Changes - ns/op |
3869341 ns/op |
3954977 ns/op |
0.98 |
BenchmarkChange/Push_10_Changes - B/op |
121627 B/op |
121234 B/op |
1.00 |
BenchmarkChange/Push_10_Changes - allocs/op |
1284 allocs/op |
1284 allocs/op |
1 |
BenchmarkChange/Push_100_Changes |
14379799 ns/op 573847 B/op 6654 allocs/op |
14811756 ns/op 572805 B/op 6654 allocs/op |
0.97 |
BenchmarkChange/Push_100_Changes - ns/op |
14379799 ns/op |
14811756 ns/op |
0.97 |
BenchmarkChange/Push_100_Changes - B/op |
573847 B/op |
572805 B/op |
1.00 |
BenchmarkChange/Push_100_Changes - allocs/op |
6654 allocs/op |
6654 allocs/op |
1 |
BenchmarkChange/Push_1000_Changes |
115374230 ns/op 5181413 B/op 63146 allocs/op |
118805815 ns/op 5363448 B/op 63150 allocs/op |
0.97 |
BenchmarkChange/Push_1000_Changes - ns/op |
115374230 ns/op |
118805815 ns/op |
0.97 |
BenchmarkChange/Push_1000_Changes - B/op |
5181413 B/op |
5363448 B/op |
0.97 |
BenchmarkChange/Push_1000_Changes - allocs/op |
63146 allocs/op |
63150 allocs/op |
1.00 |
BenchmarkChange/Pull_10_Changes |
2893035 ns/op 100983 B/op 1004 allocs/op |
2937616 ns/op 100515 B/op 1004 allocs/op |
0.98 |
BenchmarkChange/Pull_10_Changes - ns/op |
2893035 ns/op |
2937616 ns/op |
0.98 |
BenchmarkChange/Pull_10_Changes - B/op |
100983 B/op |
100515 B/op |
1.00 |
BenchmarkChange/Pull_10_Changes - allocs/op |
1004 allocs/op |
1004 allocs/op |
1 |
BenchmarkChange/Pull_100_Changes |
4321631 ns/op 266884 B/op 3475 allocs/op |
4416397 ns/op 265289 B/op 3475 allocs/op |
0.98 |
BenchmarkChange/Pull_100_Changes - ns/op |
4321631 ns/op |
4416397 ns/op |
0.98 |
BenchmarkChange/Pull_100_Changes - B/op |
266884 B/op |
265289 B/op |
1.01 |
BenchmarkChange/Pull_100_Changes - allocs/op |
3475 allocs/op |
3475 allocs/op |
1 |
BenchmarkChange/Pull_1000_Changes |
8629761 ns/op 1494538 B/op 29858 allocs/op |
8730161 ns/op 1489377 B/op 29851 allocs/op |
0.99 |
BenchmarkChange/Pull_1000_Changes - ns/op |
8629761 ns/op |
8730161 ns/op |
0.99 |
BenchmarkChange/Pull_1000_Changes - B/op |
1494538 B/op |
1489377 B/op |
1.00 |
BenchmarkChange/Pull_1000_Changes - allocs/op |
29858 allocs/op |
29851 allocs/op |
1.00 |
BenchmarkSnapshot/Push_3KB_snapshot |
16930444 ns/op 715968 B/op 6656 allocs/op |
17254259 ns/op 707879 B/op 6649 allocs/op |
0.98 |
BenchmarkSnapshot/Push_3KB_snapshot - ns/op |
16930444 ns/op |
17254259 ns/op |
0.98 |
BenchmarkSnapshot/Push_3KB_snapshot - B/op |
715968 B/op |
707879 B/op |
1.01 |
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op |
6656 allocs/op |
6649 allocs/op |
1.00 |
BenchmarkSnapshot/Push_30KB_snapshot |
118859554 ns/op 5631093 B/op 63239 allocs/op |
121668057 ns/op 5574640 B/op 63158 allocs/op |
0.98 |
BenchmarkSnapshot/Push_30KB_snapshot - ns/op |
118859554 ns/op |
121668057 ns/op |
0.98 |
BenchmarkSnapshot/Push_30KB_snapshot - B/op |
5631093 B/op |
5574640 B/op |
1.01 |
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op |
63239 allocs/op |
63158 allocs/op |
1.00 |
BenchmarkSnapshot/Pull_3KB_snapshot |
6385455 ns/op 923454 B/op 15511 allocs/op |
6461828 ns/op 921295 B/op 15513 allocs/op |
0.99 |
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op |
6385455 ns/op |
6461828 ns/op |
0.99 |
BenchmarkSnapshot/Pull_3KB_snapshot - B/op |
923454 B/op |
921295 B/op |
1.00 |
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op |
15511 allocs/op |
15513 allocs/op |
1.00 |
BenchmarkSnapshot/Pull_30KB_snapshot |
15272646 ns/op 7160783 B/op 150106 allocs/op |
15260227 ns/op 7155823 B/op 150107 allocs/op |
1.00 |
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op |
15272646 ns/op |
15260227 ns/op |
1.00 |
BenchmarkSnapshot/Pull_30KB_snapshot - B/op |
7160783 B/op |
7155823 B/op |
1.00 |
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op |
150106 allocs/op |
150107 allocs/op |
1.00 |
BenchmarkSync/memory_sync_10_test |
6736 ns/op 1286 B/op 38 allocs/op |
7041 ns/op 1286 B/op 38 allocs/op |
0.96 |
BenchmarkSync/memory_sync_10_test - ns/op |
6736 ns/op |
7041 ns/op |
0.96 |
BenchmarkSync/memory_sync_10_test - B/op |
1286 B/op |
1286 B/op |
1 |
BenchmarkSync/memory_sync_10_test - allocs/op |
38 allocs/op |
38 allocs/op |
1 |
BenchmarkSync/memory_sync_100_test |
51335 ns/op 8638 B/op 273 allocs/op |
56686 ns/op 8986 B/op 295 allocs/op |
0.91 |
BenchmarkSync/memory_sync_100_test - ns/op |
51335 ns/op |
56686 ns/op |
0.91 |
BenchmarkSync/memory_sync_100_test - B/op |
8638 B/op |
8986 B/op |
0.96 |
BenchmarkSync/memory_sync_100_test - allocs/op |
273 allocs/op |
295 allocs/op |
0.93 |
BenchmarkSync/memory_sync_1000_test |
588057 ns/op 73837 B/op 2090 allocs/op |
406994 ns/op 83233 B/op 2675 allocs/op |
1.44 |
BenchmarkSync/memory_sync_1000_test - ns/op |
588057 ns/op |
406994 ns/op |
1.44 |
BenchmarkSync/memory_sync_1000_test - B/op |
73837 B/op |
83233 B/op |
0.89 |
BenchmarkSync/memory_sync_1000_test - allocs/op |
2090 allocs/op |
2675 allocs/op |
0.78 |
BenchmarkSync/memory_sync_10000_test |
7214651 ns/op 737745 B/op 20278 allocs/op |
4089900 ns/op 799005 B/op 24135 allocs/op |
1.76 |
BenchmarkSync/memory_sync_10000_test - ns/op |
7214651 ns/op |
4089900 ns/op |
1.76 |
BenchmarkSync/memory_sync_10000_test - B/op |
737745 B/op |
799005 B/op |
0.92 |
BenchmarkSync/memory_sync_10000_test - allocs/op |
20278 allocs/op |
24135 allocs/op |
0.84 |
BenchmarkTextEditing |
5130105789 ns/op 3901871856 B/op 18743099 allocs/op |
5215484827 ns/op 3901957568 B/op 18743566 allocs/op |
0.98 |
BenchmarkTextEditing - ns/op |
5130105789 ns/op |
5215484827 ns/op |
0.98 |
BenchmarkTextEditing - B/op |
3901871856 B/op |
3901957568 B/op |
1.00 |
BenchmarkTextEditing - allocs/op |
18743099 allocs/op |
18743566 allocs/op |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
4dcb260
to
1ed50b5
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #932 +/- ##
==========================================
+ Coverage 51.23% 51.41% +0.17%
==========================================
Files 71 71
Lines 10576 10540 -36
==========================================
Hits 5419 5419
+ Misses 4614 4578 -36
Partials 543 543 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Outside diff range, codebase verification and nitpick comments (15)
server/clients/housekeeping.go (5)
33-41
: Ensure proper documentation for function parameters and return values.The function
DeactivateInactives
lacks detailed documentation for its parameters and return values. This can improve code readability and maintainability.// DeactivateInactives deactivates clients that have not been active for a long time. // Parameters: // - ctx: context for the function execution. // - be: backend instance. // - candidatesLimitPerProject: limit of candidates per project. // - projectFetchSize: number of projects to fetch. // - housekeepingLastProjectID: ID of the last project processed. // Returns: // - types.ID: ID of the last project processed. // - error: error encountered during the execution, if any.
79-86
: Enhance logging for better traceability.Include more details in the log message for better traceability.
if len(candidates) > 0 { logging.From(ctx).Infof( "HSKP: candidates %d, deactivated %d, duration %s, lastProjectID %s", len(candidates), deactivatedCount, time.Since(start), lastProjectID, ) }
91-98
: Ensure proper documentation for function parameters and return values.The function
FindDeactivateCandidates
lacks detailed documentation for its parameters and return values. This can improve code readability and maintainability.// FindDeactivateCandidates finds candidates to deactivate from the database. // Parameters: // - ctx: context for the function execution. // - be: backend instance. // - candidatesLimitPerProject: limit of candidates per project. // - projectFetchSize: number of projects to fetch. // - lastProjectID: ID of the last project processed. // Returns: // - types.ID: ID of the last project processed. // - []*database.ClientInfo: list of client information for deactivation. // - error: error encountered during the execution, if any.
99-102
: Enhance error message for better debugging.Include more context in the error message to improve debugging.
projects, err := be.DB.FindNextNCyclingProjectInfos(ctx, projectFetchSize, lastProjectID) if err != nil { return database.DefaultProjectID, nil, fmt.Errorf("failed to find next N cycling project infos: %w", err) }
106-109
: Enhance error message for better debugging.Include more context in the error message to improve debugging.
infos, err := be.DB.FindDeactivateCandidatesPerProject(ctx, project, candidatesLimitPerProject) if err != nil { return database.DefaultProjectID, nil, fmt.Errorf("failed to find deactivate candidates per project: %w", err) }test/integration/housekeeping_test.go (6)
48-69
: Ensure proper documentation for function parameters and return values.The function
setupBackend
lacks detailed documentation for its parameters and return values. This can improve code readability and maintainability.// setupBackend initializes the backend for testing purposes. // Parameters: // - t: testing instance. // Returns: // - *backend.Backend: initialized backend instance.
81-84
: Enhance error message for better debugging.Include more context in the error message to improve debugging.
lastProjectID, _, err = clients.FindDeactivateCandidates( ctx, be, 0, fetchSize, lastProjectID, ) assert.NoError(t, err, "failed to find deactivate candidates")
95-97
: Enhance error message for better debugging.Include more context in the error message to improve debugging.
lastProjectID, _, err = clients.FindDeactivateCandidates( ctx, be, 0, fetchSize, lastProjectID, ) assert.NoError(t, err, "failed to find deactivate candidates")
125-127
: Enhance error message for better debugging.Include more context in the error message to improve debugging.
_, candidates, err := clients.FindDeactivateCandidates( ctx, be, 10, 10, database.DefaultProjectID, ) assert.NoError(t, err, "failed to find deactivate candidates")
141-143
: Ensure proper documentation for function parameters and return values.The function
createProjects
lacks detailed documentation for its parameters and return values. This can improve code readability and maintainability.// createProjects creates multiple projects for testing purposes. // Parameters: // - t: testing instance. // - db: database instance. // Returns: // - []*database.ProjectInfo: list of created project information.
Line range hint
148-151
:
Enhance error message for better debugging.Include more context in the error message to improve debugging.
p, err := db.CreateProjectInfo(ctx, fmt.Sprintf("%d project", i), dummyOwnerID, clientDeactivateThreshold) assert.NoError(t, err, "failed to create project info") projects = append(projects, p) p, err = db.CreateProjectInfo(ctx, fmt.Sprintf("%d project", i), otherOwnerID, clientDeactivateThreshold) assert.NoError(t, err, "failed to create project info") projects = append(projects, p)server/server.go (4)
97-99
: Enhance error message for better debugging.Include more context in the error message to improve debugging.
if err := r.RegisterHousekeepingTasks(r.backend); err != nil { return fmt.Errorf("failed to register housekeeping tasks: %w", err) }
101-103
: Enhance error message for better debugging.Include more context in the error message to improve debugging.
if err := r.backend.Start(); err != nil { return fmt.Errorf("failed to start backend: %w", err) }
160-165
: Ensure proper documentation for function parameters and return values.The function
RegisterHousekeepingTasks
lacks detailed documentation for its parameters and return values. This can improve code readability and maintainability.// RegisterHousekeepingTasks registers housekeeping tasks. // Parameters: // - be: backend instance. // Returns: // - error: error encountered during the execution, if any.
162-165
: Enhance error message for better debugging.Include more context in the error message to improve debugging.
interval, err := be.Housekeeping.Config.ParseInterval() if err != nil { return fmt.Errorf("failed to parse housekeeping interval: %w", err) }
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
go.sum
is excluded by!**/*.sum
Files selected for processing (10)
- go.mod (5 hunks)
- server/backend/backend.go (5 hunks)
- server/backend/housekeeping/config.go (2 hunks)
- server/backend/housekeeping/housekeeping.go (1 hunks)
- server/clients/housekeeping.go (1 hunks)
- server/rpc/server_test.go (1 hunks)
- server/server.go (3 hunks)
- test/helper/helper.go (1 hunks)
- test/integration/housekeeping_test.go (5 hunks)
- test/sharding/server_test.go (1 hunks)
Additional comments not posted (24)
server/backend/housekeeping/config.go (2)
17-18
: LGTM! Enhanced package comment.The enhanced package comment provides a clearer description of the
housekeeping
package's purpose.
65-73
: LGTM! New methodParseInterval
.The new method
ParseInterval
correctly parses the interval duration and handles potential errors.server/backend/housekeeping/housekeeping.go (6)
24-24
: LGTM! New import statements.The import statements for
gocron
andlogging
are necessary for the new scheduling and logging functionalities.Also applies to: 26-26
32-34
: LGTM! SimplifiedHousekeeping
struct.The
Housekeeping
struct has been simplified by removing fields related to database interaction and task scheduling, and adding ascheduler
field, improving modularity and reducing dependencies.
38-48
: LGTM! UpdatedNew
function.The
New
function has been updated to create a newgocron.Scheduler
instance directly, reflecting the new design and improving the initialization process.
50-67
: LGTM! NewRegisterTask
method.The
RegisterTask
method correctly registers tasks with specified intervals and handles potential errors.
72-73
: LGTM! UpdatedStart
method.The
Start
method has been updated to start the scheduler, reflecting the new design and improving the start process.
78-86
: LGTM! UpdatedStop
method.The
Stop
method has been updated to stop the scheduler and handle potential errors, reflecting the new design and improving the stop process.go.mod (6)
8-8
: LGTM! New dependencygithub.com/go-co-op/gocron/v2
.The new dependency
github.com/go-co-op/gocron/v2
is necessary for the new scheduling functionalities.
20-20
: LGTM! Updated dependencygithub.com/stretchr/testify
.The version of
github.com/stretchr/testify
has been updated fromv1.8.4
tov1.9.0
, likely including enhancements in testing functionalities.
39-39
: LGTM! New indirect dependencygithub.com/google/uuid
.The new indirect dependency
github.com/google/uuid
likely provides UUID generation features.
44-44
: LGTM! New indirect dependencygithub.com/jonboulle/clockwork
.The new indirect dependency
github.com/jonboulle/clockwork
likely provides time manipulation features.
73-73
: LGTM! Updated indirect dependencygolang.org/x/exp
.The version of
golang.org/x/exp
has been updated tov0.0.0-20240613232115-7f521ea00fb8
, likely including improvements or new features in experimental Go libraries.
74-74
: LGTM! Updated indirect dependencygolang.org/x/sync
.The version of
golang.org/x/sync
has been updated tov0.7.0
, likely including improvements or new features in synchronization functionalities.server/clients/housekeeping.go (1)
44-47
: Verify the creation of the locker.Ensure that the locker is created correctly and consider adding context to the error message for better debugging.
locker, err := be.Coordinator.NewLocker(ctx, deactivateCandidatesKey) if err != nil { return database.DefaultProjectID, fmt.Errorf("failed to create locker: %w", err) }test/integration/housekeeping_test.go (2)
58-61
: Verify the creation of Prometheus metrics.Ensure that the Prometheus metrics are created correctly and consider adding context to the error message for better debugging.
metrics, err := prometheus.NewMetrics() assert.NoError(t, err, "failed to create Prometheus metrics")
61-67
: Verify the creation of the backend.Ensure that the backend is created correctly and consider adding context to the error message for better debugging.
be, err := backend.New( conf.Backend, conf.Mongo, conf.Housekeeping, metrics, ) assert.NoError(t, err, "failed to create backend")server/backend/backend.go (4)
46-50
: LGTM! The addition of theAuthWebhookCache
field enhances caching capabilities.This change improves performance and efficiency in handling webhook data.
160-168
: LGTM! TheStart
method ensures proper initialization of housekeeping tasks and logs the backend's startup status.This change improves the operational lifecycle management of the backend.
169-177
: LGTM! TheShutdown
method modification ensures a clear sequence in resource management.Closing the
Background
service after housekeeping operations maintains proper resource management.
Line range hint
64-88
:
LGTM! The restructuring of theNew
method improves code readability and maintainability.The initialization of
AuthWebhookCache
and the detailed comments enhance clarity.However, ensure that all function calls to
New
match the new signature.test/sharding/server_test.go (1)
68-68
: LGTM! The addition of theUseDefaultProject
parameter enhances the configurability of the test environment.This change allows for more flexible testing scenarios.
server/rpc/server_test.go (1)
73-73
: LGTM! The addition of theUseDefaultProject
parameter enhances the configuration capabilities of the backend.This change allows for more flexible testing scenarios.
test/helper/helper.go (1)
67-67
: LGTM! But verify the variable usage in the codebase.The introduction of the
UseDefaultProject
variable is approved.However, ensure that this variable is correctly utilized in the codebase and does not introduce any unintended side effects.
Verification successful
The usage of
UseDefaultProject
is verified and correct.The variable
UseDefaultProject
is consistently used across various parts of the codebase, including test configurations, server configurations, and interceptors. The usages align with the intended purpose of the variable, ensuring that the default project is used under specific conditions.
test/sharding/server_test.go
cmd/yorkie/server.go
server/rpc/server_test.go
server/rpc/interceptors/yorkie.go
server/config.go
server/backend/config.go
server/backend/backend.go
test/integration/housekeeping_test.go
test/helper/helper.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `UseDefaultProject` variable in the codebase. # Test: Search for the variable usage. Expect: Correct usage without unintended side effects. rg --type go 'UseDefaultProject'Length of output: 897
Script:
#!/bin/bash # Description: Gather context around the usage of `UseDefaultProject` in the identified files. # Extracting lines around the match to understand the context of usage rg --type go 'UseDefaultProject' -A 5 -B 5Length of output: 7698
1ed50b5
to
55bdb4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
go.sum
is excluded by!**/*.sum
Files selected for processing (10)
- go.mod (5 hunks)
- server/backend/backend.go (5 hunks)
- server/backend/housekeeping/config.go (2 hunks)
- server/backend/housekeeping/housekeeping.go (1 hunks)
- server/clients/housekeeping.go (1 hunks)
- server/rpc/server_test.go (1 hunks)
- server/server.go (3 hunks)
- test/helper/helper.go (1 hunks)
- test/integration/housekeeping_test.go (5 hunks)
- test/sharding/server_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (8)
- go.mod
- server/backend/backend.go
- server/backend/housekeeping/config.go
- server/clients/housekeeping.go
- server/rpc/server_test.go
- test/helper/helper.go
- test/integration/housekeeping_test.go
- test/sharding/server_test.go
Additional comments not posted (7)
server/backend/housekeeping/housekeeping.go (5)
30-35
: LGTM! The changes to theHousekeeping
struct improve modularity and maintainability.The use of
gocron
for scheduling tasks is a good choice for simplicity and flexibility.
38-48
: LGTM! The changes to theNew
function align with the new design of theHousekeeping
struct.Error handling for the scheduler creation is appropriate.
50-67
: LGTM! TheRegisterTask
function allows for flexible task registration with specified intervals.Error handling and logging are appropriately implemented.
71-73
: LGTM! The changes to theStart
function align with the new design of theHousekeeping
struct.Starting the
gocron
scheduler is straightforward and appropriate.
78-86
: LGTM! The changes to theStop
function ensure proper cleanup of the scheduler resources.Error handling is appropriately implemented.
server/server.go (2)
97-104
: LGTM! The changes to theStart
function improve the control flow by ensuring that housekeeping tasks are registered and backend services are started in a structured manner.Error handling is appropriately implemented.
160-183
: LGTM! TheRegisterHousekeepingTasks
function is well-implemented and follows best practices for resource management.The function parses the interval for task execution and registers a task to deactivate inactive clients.
What this PR does / why we need it:
This commit enhances Housekeeping to enable the addition of a variety
of tasks. Previously, Housekeeping was limited to only Client
Deactivation task.
In this update, the actual tasks are implemented in the service
package(e.g.
clients
), whilehousekeeping
package is onlyresponsible for scheduling tasks. It is for separation of concerns.
Which issue(s) this PR fixes:
Fixes #706
Special notes for your reviewer:
The introduction of
gocron
has simplified the codebase ofhousekeeping
package. It may be worth considering introducingdistributed system support of
gocron
later.Does this PR introduce a user-facing change?:
Additional documentation:
Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Documentation