Skip to content

Commit

Permalink
Synchronize map access
Browse files Browse the repository at this point in the history
Summary:
We want applying deltas to be an atomic operation, from incrementing the delta message ID to updating the relevant maps.
This is a simple approach to synchronize the corrsponding method.

We will probably need to go with a more sophisticated approach, that makes sure that deltas are applied in order. That would also allow us to lock only on writes.

Reviewed By: kathryngray

Differential Revision: D6846560

fbshipit-source-id: 175a80b4e39223883e397d75e20109fc12a2a878
  • Loading branch information
davidaurelio authored and facebook-github-bot committed Jan 31, 2018
1 parent 0009909 commit e756251
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ private static boolean storePlainJSInFile(BufferedSource body, File outputFile)
return true;
}

private boolean storeDeltaInFile(BufferedSource body, File outputFile) throws IOException {
private synchronized boolean storeDeltaInFile(BufferedSource body, File outputFile) throws IOException {

JsonReader jsonReader = new JsonReader(new InputStreamReader(body.inputStream()));

Expand Down

0 comments on commit e756251

Please sign in to comment.