feat: add panic tracking and logging with PanicTracker

- Implemented PanicTracker to log panics using tracing within a dedicated span.
- Introduced PanicInfo struct to capture panic details.
- Added tests for panic catching and hook restoration.

feat: implement token-bucket rate limiter

- Created RateLimiter to manage token consumption with configurable rates and burst capacity.
- Added methods for acquiring tokens and checking available tokens.
- Included tests for rate limiting behavior and token availability.

feat: add automatic retry with exponential backoff

- Developed retry function to handle transient errors with configurable retry strategies.
- Introduced RetryConfig for customizing retry behavior and jitter.
- Added tests for various retry scenarios and error handling.

feat: implement graceful shutdown coordination

- Created ShutdownManager to manage shutdown signals and task completion.
- Introduced ShutdownSignal for tasks to observe shutdown requests.
- Added tests for shutdown request handling and task draining.

feat: add timeout functionality for async operations

- Implemented with_timeout function to enforce execution time limits on futures.
- Created Timeout struct for wrapping futures with a deadline.
- Added tests for timeout behavior and error mapping.
This commit is contained in:
asepharyana
2026-08-28 21:46:18 +07:00
parent ca39dea5db
commit d119821339
76 changed files with 10360 additions and 191 deletions
+60 -26
View File
@@ -28,10 +28,10 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Clippy (all features)
run: cargo clippy --all-features -- -D warnings
- name: Clippy (no default features)
run: cargo clippy --no-default-features -- -D warnings
- name: Clippy (workspace, all features)
run: cargo clippy --workspace --all-features -- -D warnings
- name: Clippy (workspace, no default features)
run: cargo clippy --workspace --no-default-features -- -D warnings
test-matrix:
name: Test (${{ matrix.name }})
@@ -40,24 +40,53 @@ jobs:
fail-fast: false
matrix:
include:
- name: default features
flags: ""
- name: all features
flags: "--all-features"
- name: io only
flags: "--no-default-features --features io"
- name: compute only
flags: "--no-default-features --features compute"
- name: bg only
flags: "--no-default-features --features bg"
- name: resiliency only
flags: "--no-default-features --features resiliency"
- name: traffic only
flags: "--no-default-features --features traffic"
- name: lifecycle only
flags: "--no-default-features --features lifecycle"
- name: observability only
flags: "--no-default-features --features observability"
# Whole-workspace sanity passes.
- name: workspace default features
flags: "--workspace"
- name: workspace all features
flags: "--workspace --all-features"
# mytheclipse: execution primitives + resiliency/traffic/lifecycle/observability
- name: mytheclipse / io only
flags: "-p mytheclipse --no-default-features --features io"
- name: mytheclipse / compute only
flags: "-p mytheclipse --no-default-features --features compute"
- name: mytheclipse / bg only
flags: "-p mytheclipse --no-default-features --features bg"
- name: mytheclipse / resiliency only
flags: "-p mytheclipse --no-default-features --features resiliency"
- name: mytheclipse / traffic only
flags: "-p mytheclipse --no-default-features --features traffic"
- name: mytheclipse / lifecycle only
flags: "-p mytheclipse --no-default-features --features lifecycle"
- name: mytheclipse / observability only
flags: "-p mytheclipse --no-default-features --features observability"
# corex-cache
- name: corex-cache / default
flags: "-p corex-cache"
- name: corex-cache / l1-moka
flags: "-p corex-cache --no-default-features --features l1-moka"
- name: corex-cache / l2-redis
flags: "-p corex-cache --no-default-features --features l1-memory,l2-redis"
# corex-storage
- name: corex-storage / default (local)
flags: "-p corex-storage"
- name: corex-storage / s3
flags: "-p corex-storage --no-default-features --features s3"
- name: corex-storage / gcs
flags: "-p corex-storage --no-default-features --features gcs"
# corex-event
- name: corex-event / default (mem)
flags: "-p corex-event"
- name: corex-event / amqp
flags: "-p corex-event --no-default-features --features amqp"
- name: corex-event / nats
flags: "-p corex-event --no-default-features --features nats"
# corex-config
- name: corex-config / default
flags: "-p corex-config"
# corex-crypto
- name: corex-crypto / default
flags: "-p corex-crypto"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
@@ -67,12 +96,12 @@ jobs:
run: cargo test ${{ matrix.flags }}
example:
name: Run example
name: Run mytheclipse example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo run --example main --features full
- run: cargo run -p mytheclipse --example main --features full
docs:
name: Docs check
@@ -80,13 +109,18 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: RUSTDOCFLAGS="-D warnings" cargo doc --all-features --no-deps
- run: RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps
package:
name: Cargo package dry-run
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
crate:
[mytheclipse, corex-cache, corex-storage, corex-event, corex-config, corex-crypto]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Package
run: cargo package --no-verify
run: cargo package -p ${{ matrix.crate }} --no-verify