You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace std::time::Instant in Cloudflare-reachable core code #1075
Follow-up from PR #1074 review. std::time::Instant::now() panics on the Cloudflare adapter's wasm32-unknown-unknown target, according to the original report. PR #1074 changed its new timing paths to web_time::Instant, but two pre-existing Cloudflare-reachable core paths still import the standard-library type:
crates/trusted-server-core/src/auction/telemetry.rs uses std::time::Instant for AuctionObservationContext::started_at, creation, and elapsed time.
crates/trusted-server-core/src/integrations/datadome/protection_scope.rs imports std::time::{Duration, Instant} and uses Instant::now() when reading and populating the dynamic IP CIDR source cache.
These imports and calls remain in the current source. Reaching either call on Cloudflare can trap the worker. The original report notes that the Cloudflare integration fixture has auctions disabled and no DataDome configuration, so compile and native tests do not exercise these runtime paths.
Expected behavior
Auction telemetry and the configured DataDome IP CIDR source cache use an Instant implementation that works on Cloudflare, with their current elapsed-time and expiry behavior retained on other targets.
Proposed change
Use web_time::Instant at both sites, retaining std::time::Duration in the DataDome import. web-time is already a workspace dependency and, as noted in the original report, re-exports the standard Instant on non-wasm targets. Check that no value from either site is compared with a std::time::Instant elsewhere.
Done when
Both Cloudflare-reachable call sites use web_time::Instant; no mixed Instant types are introduced.
Target-matched build and existing native tests pass for the affected core and Cloudflare adapter paths.
Runtime coverage reaches auction telemetry with auctions enabled in workerd, closing the gap identified in the original report. Exercise the configured DataDome IP CIDR source path as well if the fixture supports it.
Activity
Use web_time::Instant for Cloudflare timing