amplify-android icon indicating copy to clipboard operation
amplify-android copied to clipboard

DataStore subscriptionDataProcessed event is dispatched twice

Open HuiSF opened this issue 4 years ago • 0 comments

Before opening, please confirm:

Language and Async Model

Java, Kotlin

Amplify Categories

DataStore

Gradle script dependencies

// Put output below this line


Environment information

# Put output below this line


Please include any relevant guides or documentation you're referencing

No response

Describe the bug

Observed from testing with amplify-flutter.

When a GraphQL subscription event arrives, after processing merge the data into local DB, subscriptionDataProcessed event gets dispatched twice via DataStore hub event channel.

It looks like that this spot were executed twice during the merge process following this order: by 1) here and 2) here

According to the source code and code commends, subscriptionDataProcessed event is dispatched on a successful data merge, which should be dispatched only once. Could you confirm if the current behavior is correct?

Additional context: amplify-ios emits a simple event syncReceived after the merging process triggered by a GraphQL subscription event. And syncReceived event gets dispatched once.

Reproduction steps (if applicable)

  1. Trigger a GraphQL subscription from any valid source
  2. Observe subscriptionDataProcessed event on DataStore hub

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line


Additional information and screenshots

No response

HuiSF avatar Feb 11 '22 17:02 HuiSF