Skip to content

Commit

Permalink
Merge branch 'master' of github.com:UnitedTraders/aeron-rs into refac…
Browse files Browse the repository at this point in the history
…toring/aeron-errors
  • Loading branch information
KiriosK committed Mar 7, 2021
2 parents f18eb42 + ce3a0f8 commit c79cfd0
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 1 deletion.
81 changes: 81 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Rust CI
on:
push:
pull_request:
types: [opened, repoened, synchronize]

jobs:
test:
name: Test Rust ${{matrix.toolchain}} on ${{matrix.os}}
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, nightly]
os: [ubuntu] # linux-only
steps:
- uses: actions/checkout@master
with:
submodules: 'true'
- name: Get latest CMake
uses: lukka/get-cmake@latest
- name: configure aeronmd
run: mkdir build && cd build && cmake -G "CodeBlocks - Unix Makefiles" ../
working-directory: aeron
- name: build aeronmd
run: make aeronmd && mkdir -p $(systemd-path user-binaries) && mv ./binaries/aeronmd $(systemd-path user-binaries)
working-directory: aeron/build
- name: Set environment variables
shell: bash
run: |
echo "$(systemd-path user-binaries)" >> $GITHUB_PATH
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{matrix.toolchain}}
override: true
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-targets -- --test-threads=1
env:
RUST_LOG: 'trace'

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
override: true

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --all-targets --all-features -- -D clippy::all -D warnings

rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install minimal stable with rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true

- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ chrono = "0.4"
tempfile = "3.1"
hdrhistogram = "6.0"
structopt = "0.3"

[build-dependencies]
rustc_version = "0.3"
9 changes: 9 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extern crate rustc_version;
use rustc_version::{version_meta, Channel};

fn main() {
// Set cfg flags depending on release channel
if let Channel::Nightly = version_meta().unwrap().channel {
println!("cargo:rustc-cfg=nightly");
}
}
9 changes: 8 additions & 1 deletion src/client_conductor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ struct CounterStateDefn {
counter: Option<Weak<Counter>>,
registration_id: i64,
time_of_registration_ms: Moment,
#[allow(dead_code)]
counter_id: i32,
status: RegistrationStatus,
error_code: i32,
Expand Down Expand Up @@ -446,7 +447,13 @@ impl ClientConductor {
self.time_of_last_do_work_ms = now_ms;

if now_ms > self.time_of_last_keepalive_ms + KEEPALIVE_TIMEOUT_MS {
if now_ms > self.driver_proxy.time_of_last_driver_keepalive() as Moment + self.driver_timeout_ms {
let last_keepalive: Moment = if self.driver_proxy.time_of_last_driver_keepalive() >= 0 {
self.driver_proxy.time_of_last_driver_keepalive() as Moment + self.driver_timeout_ms
} else {
MAX_MOMENT
};

if now_ms > last_keepalive {
self.driver_active.store(false, Ordering::SeqCst);

let err = DriverTimeoutError::WasInactive(self.driver_timeout_ms).into();
Expand Down

0 comments on commit c79cfd0

Please sign in to comment.