Commit Graph
14 Commits
Author SHA1 Message Date
Jacek Sieka 890687e7e0 Merge branch 'master' into asyncdispatch_stacktrace_port 2026-06-17 09:16:13 +02:00
Andrii Fil 43a9c42546 Update examples.md (#648) 2026-05-05 09:25:35 +02:00
Constantine MolchanovandJacek Sieka 82ecd2248d Add the book update guide (#620)
* Update mdbook-open-on-gh version.

2.4.1 would crash during build locally.

* Fix path to async_procs.md.

* Add the guide to update the book.

---------

Co-authored-by: Jacek Sieka <jacek@status.im>
2026-04-01 17:02:12 +02:00
Jacek Sieka 673ad0094c TCP server example (#478) 2026-01-19 16:55:36 +01:00
NagyZoltanPeterandJacek Sieka 85af4db764 Token bucket unification (#582)
* Fix original TokenBucket, consolidate the behaviors of chronos/TokenBucket and waku/TokenBucket (compensating) with no interface change

* TokenBucket extended with waku's strict mode replenish, that does not allow refill just after period boundary elapsed.

* Adjust for new chat-sdk needs, added setState and getAvailableCapacity with small refactoring

* Better comments

* rename for better self explain code, added more explanatory comments upon code review finding

* Document TokenBucket with detailed samples of Balanced mode replenishment algorithm, extended TokenBucket unit test

* Address review comments, renaming the replenish modes, removed old/new algo comparison from documentation, fix Discrete mode update calculation to properly calculate correct last update time by period distance calculation.

* protect from devide by zero, code style fix

* Make (re)setState close pending request before reseting state

* Polishing interface, move discrete mode initial start time setup into ctor and remove resetState to have a cleaner and consistent interface for both usage mode

* Addressing review observation, keep only singel new ctor and leave defaults to match former use.

* Removing leftovers and confirm with coding guideline

* refactor rate limiter implementation

* make sure that `tryConsume` respects queued `consume` requests
* refill tokens the same way regardless of replenish mode and source of
tokens (manual/time-based/cancellation)
* whem manually replenishing, compute budget cap after satisfying queued
requests
* don't run worker if fill duration is 0
* add some docs

* int vs int64

* Fix Discrete mode time window drift, added tests

* wait for sleeper/waiter

---------

Co-authored-by: Jacek Sieka <jacek@status.im>
2025-12-12 15:25:45 +01:00
nitely 543e731859 Port asyncdispatch stacktraces improvement 2025-11-29 21:56:55 -03:00
Giuliano Mega 7630f39471 Fixes compilation issues in v3 compatibility mode (-d:chronosHandleException) (#545)
* add missing calls to await

* add test run in v3 compatibility

* fix semantics for chronosHandleException so it does not override local raises/handleException annotations

* distinguish between explicit override and default setting; fix test

* re-enable wrongly disabled check

* make implementation simpler/clearer

* update docs

* reflow long line

* word swap
2024-06-10 10:18:42 +02:00
Jacek Sieka 8a306763ce docs for join and noCancel 2024-05-07 17:19:35 +02:00
Jacek Sieka 8cf2d69aaa Minimal threading docs (#493)
* Minimal threading docs

* compile examples with threads

* links
2024-02-14 08:27:09 +01:00
cheatfate 92acf68b04 Fix examples documentation. 2024-01-12 15:39:45 +02:00
Eugene Kabanov b02b9608c3 HTTP server middleware implementation. (#483)
* HTTP server middleware implementation and test.

* Address review comments.

* Address review comments.
2024-01-12 15:27:36 +02:00
Jacek Sieka 48b2b08cfb Update docs (#480)
* new mdbook version with built-in Nim highlighting support
* describe examples in a dedicated page
* fixes
2023-12-01 12:33:28 +01:00
Jacek Sieka 1306170255 dedicated exceptions for Future.read failures (#474)
Dedicated exceptions for `read` failures reduce the risk of mixing up
"user" exceptions with those of Future itself. The risk still exists, if
the user allows a chronos exception to bubble up explicitly.

Because `await` structurally guarantees that the Future is not `pending`
at the time of `read`, it does not raise this new exception.

* introduce `FuturePendingError` and `FutureCompletedError` when
`read`:ing a future of uncertain state
* fix `waitFor` / `read` to return `lent` values
* simplify code generation for `void`-returning async procs
* document `Raising` type helper
2023-11-17 13:45:17 +01:00
Jacek Sieka 24be151cf3 move docs to docs (#466)
* introduce user guide based on `mdbook`
* set up structure for adding simple `chronos` usage examples
* move most readme content to book
* ci deploys book and api guide automatically
* remove most of existing engine docs (obsolete)
2023-11-15 09:06:37 +01:00