Skip to content

Commit

Permalink
Hack to make it fail once then succeed
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerkaraszewski committed Jun 21, 2024
1 parent ff798a0 commit 4236694
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sqlitecluster/SQLiteNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,8 @@ void SQLiteNode::_changeState(SQLiteNodeState newState, uint64_t commitIDToCance
}
}

static int __ATTEMPTS = 0;

void SQLiteNode::_queueSynchronize(const SQLiteNode* const node, SQLitePeer* peer, SQLite& db, SData& response, bool sendAll) {
// We need this to check the state of the node, and we also need `name` to make the logging macros work in a static
// function. However, if you pass a null pointer here, we can't set these, so we'll fail. We also can't log that,
Expand Down Expand Up @@ -2139,7 +2141,12 @@ void SQLiteNode::_queueSynchronize(const SQLiteNode* const node, SQLitePeer* pee
// We set this for all commits because this only gets all commits in response to SUBSCRIBE, which is done synchronously, and blocks the commit thread.
// For asynchronous queries, there's nothing being blocked, so it doesn't much matter how long these take.
// This is really not the correct encapsulation for this, but we can improve that later.
timeoutLimitUS = 100;
if (__ATTEMPTS) {
timeoutLimitUS = 10'000;
} else {
timeoutLimitUS = 100;
}
__ATTEMPTS++;
} else {
toIndex = min(toIndex, fromIndex + 100); // 100 transactions at a time
}
Expand Down

0 comments on commit 4236694

Please sign in to comment.