Skip to content

Commit

Permalink
fix: fluvio time panicking on wasm (#4367)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraidev authored Jan 28, 2025
1 parent 5c95628 commit 13465d7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ wasm-bindgen-test = "0.3.24"
wasi-common = { version = "29.0.1" }
wasmtime = { version = "29.0.1" }
wasmparser = "0.224.0"
web-time = "1.1.0"
which = "7.0.1"
x509-parser = "0.16.0"

Expand Down
3 changes: 2 additions & 1 deletion crates/fluvio/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio"
version = "0.24.3"
version = "0.24.4"
edition = "2021"
license = "Apache-2.0"
authors = ["Fluvio Contributors <team@fluvio.io>"]
Expand Down Expand Up @@ -73,6 +73,7 @@ fluvio-spu-schema = { workspace = true, features = ["file"] }
fluvio-spu-schema = { workspace = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
web-time = { workspace = true }
fluvio-spu-schema = { workspace = true }
chrono = { workspace = true, features = ["wasmbind", "clock"] }

Expand Down
7 changes: 6 additions & 1 deletion crates/fluvio/src/producer/accumulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
use std::time::{Duration, Instant};
use std::time::Duration;

#[cfg(not(target_arch = "wasm32"))]
use std::time::Instant;
#[cfg(target_arch = "wasm32")]
use web_time::Instant;

use async_channel::Sender;
use async_lock::RwLock;
Expand Down
4 changes: 4 additions & 0 deletions crates/fluvio/src/producer/record.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use std::sync::Arc;

#[cfg(not(target_arch = "wasm32"))]
use std::time::Instant;
#[cfg(target_arch = "wasm32")]
use web_time::Instant;

use async_channel::Receiver;
use async_lock::RwLock;
Expand Down

0 comments on commit 13465d7

Please sign in to comment.