Skip to content

fix(dynamodb): avoid blocking IO inside Uni in DynamoDbIncrementRepository #332

Description

@yuokada

Background

Raised in PR #330 review (Copilot, comment r2936080069).

DynamoDbIncrementRepository.delete() and keys() return Uni<…> but internally call the synchronous DynamoDbClient, which blocks the calling thread. When these methods are invoked on an event-loop thread (e.g. from a reactive REST endpoint) this can stall the Vert.x event loop.

Affected methods

Method Current client Problem
delete(String key) asyncClient.deleteItem(…) OK — uses async client ✓
keys() asyncClient.scan(…) OK — uses async client ✓
get(String key) client (sync) Blocking — called from non-@Blocking context
set(String key, long value) client (sync) Blocking — called from non-@Blocking context
increment(String key, long by) client (sync) Blocking — called from non-@Blocking context

Expected fix

Either:

  1. Annotate the resource/service methods that call get/set/increment with @Blocking, or
  2. Switch get, set, increment to use DynamoDbAsyncClient and return Uni.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions