Skip to content

feat: thread blocking_subscribe through PUT/GET operations#2878

Closed
iduartgomez wants to merge 1 commit intomainfrom
nxd-3281-add-success-rate-backend
Closed

feat: thread blocking_subscribe through PUT/GET operations#2878
iduartgomez wants to merge 1 commit intomainfrom
nxd-3281-add-success-rate-backend

Conversation

@iduartgomez
Copy link
Copy Markdown
Collaborator

Problem

When clients use subscribe=true on PUT/GET operations, subscriptions happen asynchronously. The blocking subscription infrastructure already exists (start_subscription_after_put() and start_subscription_request() both accept a blocking_subscription: bool), but the value was always hardcoded to false with TODO comments saying it should come from ContractRequest once stdlib was updated.

Solution

With freenet-stdlib 0.1.33 now providing blocking_subscribe: bool on ContractRequest::Put and ContractRequest::Get, this PR wires the field through the entire operation pipeline:

  • put.rs: Added blocking_subscribe to PutState::PrepareRequest / AwaitingResponse, start_op() / start_op_with_id() signatures, and replaced all hardcoded false in start_subscription_after_put() calls (4 sites)
  • get.rs: Added blocking_subscribe to GetState::PrepareRequest / AwaitingResponse, start_op() / start_op_with_id() signatures, and wired it through start_subscription_request() calls (2 sites, guarded by subscribe_requested && blocking_sub)
  • client_events/mod.rs: Extracts blocking_subscribe from ContractRequest and threads it through all PUT/GET code paths (local-only, dedup router, legacy)
  • request_router.rs: Added blocking_subscribe field to DeduplicatedRequest::Get and DeduplicatedRequest::Put
  • Updated all call sites across core, fdev, and ping app with blocking_subscribe: false default

Backward compatible: the field defaults to false in both FlatBuffers and serde, so existing clients are unaffected.

Testing

  • cargo fmt — clean
  • cargo clippy --all-targets --all-features — no warnings
  • cargo test -p freenet --lib — 1280 passed, 0 failed
  • All request_router unit tests pass (18/18)

Dependencies

Wire the new `blocking_subscribe` field from `ContractRequest::Put`
and `ContractRequest::Get` (added in freenet-stdlib 0.1.33) through
the operation state machines so that clients can opt into synchronous
subscription behavior.

Key changes:
- put.rs: Add `blocking_subscribe` to PutState, start_op signatures,
  and replace hardcoded `false` in start_subscription_after_put calls
- get.rs: Add `blocking_subscribe` to GetState, start_op signatures,
  and use it in start_subscription_request calls
- client_events/mod.rs: Extract and thread the field through all
  PUT/GET code paths (local, dedup, legacy)
- request_router.rs: Add field to DeduplicatedRequest variants
- Update all call sites across core, fdev, and ping app
@iduartgomez iduartgomez force-pushed the nxd-3281-add-success-rate-backend branch from 9ebc715 to 4231f73 Compare February 6, 2026 13:38
@iduartgomez iduartgomez closed this Feb 6, 2026
@iduartgomez iduartgomez deleted the nxd-3281-add-success-rate-backend branch February 6, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant