Skip to content

Commit

Permalink
Merge pull request #1362 from Expensify/main
Browse files Browse the repository at this point in the history
Update expensify_prod branch
  • Loading branch information
iwiznia authored Aug 31, 2022
2 parents 9391ca7 + 653709f commit 14b7432
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions sqlitecluster/SQLiteNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,12 +1452,22 @@ void SQLiteNode::_onMESSAGE(SQLitePeer* peer, const SData& message) {
SData response("SYNCHRONIZE_RESPONSE");
SQLiteScopedHandle dbScope(*_dbPool, _dbPool->getIndex());
SQLite& db = dbScope.db();
_queueSynchronize(this, peer, db, response, false);
try {
_queueSynchronize(this, peer, db, response, false);

// The following two lines are copied from `_sendToPeer`.
response["CommitCount"] = to_string(db.getCommitCount());
response["Hash"] = db.getCommittedHash();
peer->sendMessage(response);
} catch (const SException& e) {
// This is the same handling as at the bottom of _onMESSAGE.
PWARN("Error processing message '" << message.methodLine << "' (" << e.what() << "), reconnecting.");
SData reconnect("RECONNECT");
reconnect["Reason"] = e.what();
peer->sendMessage(reconnect.serialize());
peer->shutdownSocket();
}

// The following two lines are copied from `_sendToPeer`.
response["CommitCount"] = to_string(db.getCommitCount());
response["Hash"] = db.getCommittedHash();
peer->sendMessage(response);
_pendingSynchronizeResponses--;
}).detach();
}
Expand Down

0 comments on commit 14b7432

Please sign in to comment.