Commit graph

26 commits

Author SHA1 Message Date
41690c21e5
[#9999] mclock: Schedule by limit requests as soon as possible
All checks were successful
DCO action / DCO (pull_request) Successful in 24s
Vulncheck / Vulncheck (pull_request) Successful in 31s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m10s
Tests and linters / Run gofumpt (pull_request) Successful in 1m4s
Tests and linters / Lint (pull_request) Successful in 1m12s
Tests and linters / gopls check (pull_request) Successful in 1m11s
Tests and linters / Staticcheck (pull_request) Successful in 1m18s
Tests and linters / Tests with -race (pull_request) Successful in 1m30s
Tests and linters / Tests (pull_request) Successful in 1m3s
Let's assume that for some tag `limit = 1000 RPS` defined and each
request takes 10 ms to complete. At some point in time 1000 requests
were accepted. Then first request will be scheduled at `now()`, second -
at `now() + 1 ms`, third - at `now() + 2 ms` etc. Total processing
duration of 1000 requests will be 1 second + 10 ms.

After this fix scheduler looks forward to schedule requests within limit.
So for situation above total processing duration of 1000 requests will be
10 ms in ideal world.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-03-24 15:33:50 +03:00
32079ad7c2
[#12] grpc: Fix method name
All checks were successful
DCO action / DCO (pull_request) Successful in 27s
Vulncheck / Vulncheck (pull_request) Successful in 40s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m17s
Tests and linters / Run gofumpt (pull_request) Successful in 1m15s
Tests and linters / Tests (pull_request) Successful in 1m21s
Tests and linters / Staticcheck (pull_request) Successful in 1m21s
Tests and linters / Tests with -race (pull_request) Successful in 1m22s
Tests and linters / Lint (pull_request) Successful in 1m25s
Tests and linters / gopls check (pull_request) Successful in 1m25s
Vulncheck / Vulncheck (push) Successful in 48s
Tests and linters / Run gofumpt (push) Successful in 1m11s
Tests and linters / Staticcheck (push) Successful in 1m16s
Tests and linters / Lint (push) Successful in 1m22s
Pre-commit hooks / Pre-commit (push) Successful in 1m34s
Tests and linters / Tests (push) Successful in 1m43s
Tests and linters / Tests with -race (push) Successful in 1m45s
Tests and linters / gopls check (push) Successful in 1m46s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-03-20 17:24:39 +03:00
1ca213ee7c
[#12] mclock: Fix deadlock caused by mclock.Close
All checks were successful
DCO action / DCO (pull_request) Successful in 21s
Vulncheck / Vulncheck (pull_request) Successful in 42s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m14s
Tests and linters / Lint (pull_request) Successful in 1m14s
Tests and linters / Run gofumpt (pull_request) Successful in 1m10s
Tests and linters / Staticcheck (pull_request) Successful in 1m17s
Tests and linters / Tests (pull_request) Successful in 1m6s
Tests and linters / Tests with -race (pull_request) Successful in 1m22s
Tests and linters / gopls check (pull_request) Successful in 1m29s
Deadlock scenario:
- mclock closed by `Close` method, it locks mutex and calls `clock.close`
- clock starts `scheduleRequest` goroutine, it tries to lock mutex
- `clock.Close` waits for all goroutines

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-03-20 10:31:15 +03:00
346752477b
[#12] mclock: Fix timer-based scheduling
All checks were successful
DCO action / DCO (pull_request) Successful in 21s
Vulncheck / Vulncheck (pull_request) Successful in 34s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m13s
Tests and linters / Tests with -race (pull_request) Successful in 1m14s
Tests and linters / Run gofumpt (pull_request) Successful in 1m13s
Tests and linters / gopls check (pull_request) Successful in 1m17s
Tests and linters / Lint (pull_request) Successful in 1m22s
Tests and linters / Staticcheck (pull_request) Successful in 1m18s
Tests and linters / Tests (pull_request) Successful in 1m27s
Let's assume that there are two requests in the queue with execution time t1 and t2.
The timer is set to t1. The timer is triggered, schedules the t1 request,
calculates the time for the next timer t2 to be triggered.
But it doesn't schedules timer to this time because of the
`q.timeBasedScheduleTs > nextTs` check.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-03-19 17:12:00 +03:00
3e7ca94035
Revert "[#7] mclock: Add tag stat"
All checks were successful
DCO action / DCO (pull_request) Successful in 26s
Vulncheck / Vulncheck (pull_request) Successful in 38s
Tests and linters / Run gofumpt (pull_request) Successful in 1m9s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m18s
Tests and linters / Lint (pull_request) Successful in 1m16s
Tests and linters / Staticcheck (pull_request) Successful in 1m18s
Tests and linters / gopls check (pull_request) Successful in 1m33s
Tests and linters / Tests (pull_request) Successful in 1m40s
Tests and linters / Tests with -race (pull_request) Successful in 1m52s
Vulncheck / Vulncheck (push) Successful in 39s
Pre-commit hooks / Pre-commit (push) Successful in 1m15s
Tests and linters / Run gofumpt (push) Successful in 1m17s
Tests and linters / Lint (push) Successful in 1m24s
Tests and linters / Staticcheck (push) Successful in 1m20s
Tests and linters / Tests with -race (push) Successful in 1m36s
Tests and linters / gopls check (push) Successful in 1m42s
Tests and linters / Tests (push) Successful in 1m54s
This reverts commit 25102d1e1a.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-03-10 16:58:38 +03:00
d752a1c95e
[#6] pre-commit: Add hook for running gofumpt
All checks were successful
DCO action / DCO (pull_request) Successful in 29s
Vulncheck / Vulncheck (pull_request) Successful in 37s
Tests and linters / Run gofumpt (pull_request) Successful in 52s
Tests and linters / Tests with -race (pull_request) Successful in 1m9s
Tests and linters / Staticcheck (pull_request) Successful in 1m10s
Tests and linters / Tests (pull_request) Successful in 1m20s
Tests and linters / Lint (pull_request) Successful in 1m25s
Tests and linters / gopls check (pull_request) Successful in 1m22s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m28s
Vulncheck / Vulncheck (push) Successful in 36s
Tests and linters / Run gofumpt (push) Successful in 55s
Tests and linters / Lint (push) Successful in 1m13s
Tests and linters / gopls check (push) Successful in 1m12s
Pre-commit hooks / Pre-commit (push) Successful in 1m23s
Tests and linters / Staticcheck (push) Successful in 1m20s
Tests and linters / Tests (push) Successful in 1m23s
Tests and linters / Tests with -race (push) Successful in 1m31s
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
2025-03-04 13:01:33 +03:00
deaae4d37a
[#6] Makefile: Remove fmt rule, use fumpt rule instead
There were several problems:
- `fmt` was a duplicate of `fumpt`
- `fmt` used globally installed `gofumpt`

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
2025-03-04 13:01:25 +03:00
25102d1e1a [#7] mclock: Add tag stat
All checks were successful
Vulncheck / Vulncheck (push) Successful in 33s
Pre-commit hooks / Pre-commit (push) Successful in 1m17s
Tests and linters / Tests (push) Successful in 1m16s
Tests and linters / Run gofumpt (push) Successful in 1m16s
Tests and linters / gopls check (push) Successful in 1m18s
Tests and linters / Lint (push) Successful in 1m28s
Tests and linters / Staticcheck (push) Successful in 1m24s
Tests and linters / Tests with -race (push) Successful in 1m41s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-02-27 07:29:15 +00:00
cafa869fea
[#8] limiting: Make SemaphoreLimiter.Acquire() zero-alloc
All checks were successful
DCO action / DCO (pull_request) Successful in 29s
Vulncheck / Vulncheck (pull_request) Successful in 44s
Tests and linters / Run gofumpt (pull_request) Successful in 48s
Tests and linters / Staticcheck (pull_request) Successful in 50s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m23s
Tests and linters / Lint (pull_request) Successful in 1m24s
Tests and linters / gopls check (pull_request) Successful in 1m20s
Tests and linters / Tests (pull_request) Successful in 1m29s
Tests and linters / Tests with -race (pull_request) Successful in 1m46s
Vulncheck / Vulncheck (push) Successful in 35s
Tests and linters / Tests with -race (push) Successful in 56s
Tests and linters / Tests (push) Successful in 1m12s
Pre-commit hooks / Pre-commit (push) Successful in 1m15s
Tests and linters / Lint (push) Successful in 1m23s
Tests and linters / Run gofumpt (push) Successful in 1m17s
Tests and linters / Staticcheck (push) Successful in 1m27s
Tests and linters / gopls check (push) Successful in 1m42s
Previously, `Acquire` on exising key did 1 allocation because
`func() { sem.Release() }` was a closure capturing different variables.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-02-26 18:03:41 +03:00
356851eed3
[#4] limiting/semaphore: Add benchmark for semaphore
All checks were successful
DCO action / DCO (pull_request) Successful in 35s
Tests and linters / Run gofumpt (pull_request) Successful in 47s
Vulncheck / Vulncheck (pull_request) Successful in 48s
Tests and linters / Staticcheck (pull_request) Successful in 1m7s
Tests and linters / Lint (pull_request) Successful in 1m29s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m37s
Tests and linters / Tests (pull_request) Successful in 1m38s
Tests and linters / Tests with -race (pull_request) Successful in 1m36s
Tests and linters / gopls check (pull_request) Successful in 1m46s
Vulncheck / Vulncheck (push) Successful in 46s
Tests and linters / Run gofumpt (push) Successful in 45s
Tests and linters / Staticcheck (push) Successful in 1m8s
Tests and linters / Tests (push) Successful in 1m28s
Tests and linters / Lint (push) Successful in 1m36s
Pre-commit hooks / Pre-commit (push) Successful in 1m44s
Tests and linters / Tests with -race (push) Successful in 1m37s
Tests and linters / gopls check (push) Successful in 1m47s
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
2025-02-13 15:50:59 +03:00
59fb93fb23
[#4] limiting: Add limiter
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
2025-02-13 15:38:27 +03:00
30e83428fd [#5] govulncheck: Fix minor update problems for good
All checks were successful
Tests and linters / Tests with -race (pull_request) Successful in 1m50s
Tests and linters / Run gofumpt (pull_request) Successful in 51s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m9s
DCO action / DCO (pull_request) Successful in 2m11s
Tests and linters / gopls check (pull_request) Successful in 1m49s
Vulncheck / Vulncheck (pull_request) Successful in 2m11s
Tests and linters / Tests (pull_request) Successful in 3m43s
Tests and linters / Lint (pull_request) Successful in 3m46s
Tests and linters / Staticcheck (pull_request) Successful in 3m40s
Vulncheck / Vulncheck (push) Successful in 36s
Pre-commit hooks / Pre-commit (push) Successful in 1m13s
Tests and linters / Tests (push) Successful in 1m20s
Tests and linters / gopls check (push) Successful in 1m15s
Tests and linters / Tests with -race (push) Successful in 1m31s
Tests and linters / Staticcheck (push) Successful in 1m31s
Tests and linters / Lint (push) Successful in 1m39s
Tests and linters / Run gofumpt (push) Successful in 1m32s
Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2025-02-10 18:39:38 +03:00
cfbca7fa1d [#3] govulncheck: Use patch release with security fixes
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m9s
Vulncheck / Vulncheck (pull_request) Successful in 1m25s
DCO action / DCO (pull_request) Successful in 2m18s
Tests and linters / Tests with -race (pull_request) Successful in 2m18s
Tests and linters / Staticcheck (pull_request) Successful in 2m47s
Tests and linters / Tests (pull_request) Successful in 2m55s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m3s
Tests and linters / Lint (pull_request) Successful in 3m10s
Tests and linters / gopls check (pull_request) Successful in 3m19s
Tests and linters / Run gofumpt (push) Successful in 23s
Vulncheck / Vulncheck (push) Successful in 34s
Tests and linters / Staticcheck (push) Successful in 58s
Pre-commit hooks / Pre-commit (push) Successful in 1m23s
Tests and linters / Lint (push) Successful in 1m26s
Tests and linters / gopls check (push) Successful in 1m39s
Tests and linters / Tests (push) Successful in 46s
Tests and linters / Tests with -race (push) Successful in 2m1s
https://go.dev/doc/devel/release#go1.23.minor

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2025-01-28 18:03:13 +03:00
128933fade
[#2] Add CODEOWNERS
Some checks failed
DCO action / DCO (pull_request) Successful in 29s
Tests and linters / Run gofumpt (pull_request) Successful in 29s
Vulncheck / Vulncheck (pull_request) Failing after 37s
Tests and linters / Tests (pull_request) Successful in 45s
Tests and linters / Tests with -race (pull_request) Successful in 54s
Tests and linters / Staticcheck (pull_request) Successful in 1m1s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m18s
Tests and linters / Lint (pull_request) Successful in 1m27s
Tests and linters / gopls check (pull_request) Successful in 1m45s
Tests and linters / Run gofumpt (push) Successful in 22s
Vulncheck / Vulncheck (push) Failing after 39s
Tests and linters / Staticcheck (push) Successful in 57s
Pre-commit hooks / Pre-commit (push) Successful in 1m19s
Tests and linters / gopls check (push) Successful in 1m17s
Tests and linters / Lint (push) Successful in 1m25s
Tests and linters / Tests (push) Successful in 1m31s
Tests and linters / Tests with -race (push) Successful in 1m42s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 14:29:37 +03:00
1fb8b137c5
[#2] tagging: Add grpc and context methods
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 14:29:36 +03:00
f4d8ebf13d
[#1] mclock: Add assert package
All checks were successful
DCO action / DCO (pull_request) Successful in 26s
Vulncheck / Vulncheck (pull_request) Successful in 29s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m9s
Tests and linters / gopls check (pull_request) Successful in 1m5s
Tests and linters / Tests (pull_request) Successful in 1m3s
Tests and linters / Lint (pull_request) Successful in 1m13s
Tests and linters / Run gofumpt (pull_request) Successful in 1m12s
Tests and linters / Staticcheck (pull_request) Successful in 1m13s
Tests and linters / Tests with -race (pull_request) Successful in 1m21s
Tests and linters / Run gofumpt (push) Successful in 32s
Vulncheck / Vulncheck (push) Successful in 36s
Tests and linters / Staticcheck (push) Successful in 49s
Pre-commit hooks / Pre-commit (push) Successful in 1m10s
Tests and linters / Lint (push) Successful in 1m12s
Tests and linters / Tests (push) Successful in 1m15s
Tests and linters / Tests with -race (push) Successful in 1m17s
Tests and linters / gopls check (push) Successful in 1m20s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 11:35:54 +03:00
9a48a50220
[#1] mclock: Refactor scheduleRequest
Split to `scheduleRequest` and `scheduleRequestUnsafe`.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 11:23:07 +03:00
d8663f1a74
[#1] mclock: Fix possible deadlock
There is a possible call-chain `scheduleRequest()` -> `runAt()` -> `scheduleRequest()`,
so second `scheduleRequest()` may be locked on mutext held by first `scheduleRequest()`.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 11:20:54 +03:00
f1cb5b40d5
[#1] mclock: Use time.Duration for idle timeout
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 11:20:54 +03:00
47559a8d16
[#1] mclock: Refactor: split code between files
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 11:20:53 +03:00
54b4bf7cc1
[#1] mclock: Fix time based scheduling
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 11:20:53 +03:00
e18d1a7c45
[#1] mclock: Fix bench format
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 11:20:52 +03:00
f51c095236
[#1] pre-commit: Use local golangci-lint hook
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 11:20:52 +03:00
7833c3aac5
[#1] Makefile: Create directory with parents
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 11:20:51 +03:00
0dccab22c2
[#1] mclock: Initial implementation
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-28 11:20:51 +03:00
eca6765dda
Initial commit
Some checks failed
Tests and linters / Lint (push) Failing after 11s
Tests and linters / Tests (push) Failing after 11s
Tests and linters / Staticcheck (push) Failing after 13s
Tests and linters / Run gofumpt (push) Failing after 13s
Tests and linters / Tests with -race (push) Failing after 16s
Tests and linters / gopls check (push) Failing after 16s
Vulncheck / Vulncheck (push) Successful in 32s
Pre-commit hooks / Pre-commit (push) Successful in 49s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-20 16:02:19 +03:00