mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Don't send more than 1 newline/sec while loading RDB.
This commit is contained in:
parent
27db38d069
commit
7c531eb5ad
@ -1066,15 +1066,19 @@ void rdbLoadProgressCallback(rio *r, const void *buf, size_t len) {
|
|||||||
(r->processed_bytes + len)/server.loading_process_events_interval_bytes > r->processed_bytes/server.loading_process_events_interval_bytes)
|
(r->processed_bytes + len)/server.loading_process_events_interval_bytes > r->processed_bytes/server.loading_process_events_interval_bytes)
|
||||||
{
|
{
|
||||||
if (server.masterhost && server.repl_state == REDIS_REPL_TRANSFER) {
|
if (server.masterhost && server.repl_state == REDIS_REPL_TRANSFER) {
|
||||||
|
static time_t newline_sent;
|
||||||
/* Avoid the master to detect the slave is timing out while
|
/* Avoid the master to detect the slave is timing out while
|
||||||
* loading the RDB file in initial synchronization. We send
|
* loading the RDB file in initial synchronization. We send
|
||||||
* a single newline character that is valid protocol but is
|
* a single newline character that is valid protocol but is
|
||||||
* guaranteed to either be sent entierly or not, since the byte
|
* guaranteed to either be sent entierly or not, since the byte
|
||||||
* is indivisible. */
|
* is indivisible. */
|
||||||
|
if (time(NULL) != newline_sent) {
|
||||||
|
newline_sent = time(NULL);
|
||||||
if (write(server.repl_transfer_s,"\n",1) == -1) {
|
if (write(server.repl_transfer_s,"\n",1) == -1) {
|
||||||
/* Pinging back in this stage is best-effort. */
|
/* Pinging back in this stage is best-effort. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
loadingProgress(r->processed_bytes);
|
loadingProgress(r->processed_bytes);
|
||||||
aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT);
|
aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user