mirror of
https://github.com/XTXMarkets/ternfs.git
synced 2026-05-01 23:29:15 -05:00
Process CDC timeouts in a timely manner
This commit is contained in:
+2
-1
@@ -272,7 +272,8 @@ public:
|
||||
}
|
||||
|
||||
LOG_DEBUG(_env, "Blocking to wait for readable sockets");
|
||||
if (unlikely(poll(_socks.data(), _socks.size()) < 0)) {
|
||||
// Only timeout if there are outstanding shard requests
|
||||
if (unlikely(poll(_socks.data(), _socks.size(), (_inFlightShardReqs.size() > 0) ? _shardTimeout : -1) < 0)) {
|
||||
if (errno == EINTR) { return; }
|
||||
throw SYSCALL_EXCEPTION("poll");
|
||||
}
|
||||
|
||||
+3
-2
@@ -73,8 +73,9 @@ void Loop::run() {
|
||||
while (!stopLoop.load()) { step(); }
|
||||
}
|
||||
|
||||
int Loop::poll(struct pollfd* fds, nfds_t nfds) {
|
||||
return ppoll(fds, nfds, nullptr, &blockingSigset);
|
||||
int Loop::poll(struct pollfd* fds, nfds_t nfds, Duration timeout) {
|
||||
struct timespec spec = timeout.timespec();
|
||||
return ppoll(fds, nfds, &spec, &blockingSigset);
|
||||
}
|
||||
|
||||
void Loop::stop() {
|
||||
|
||||
+3
-2
@@ -46,8 +46,9 @@ public:
|
||||
|
||||
void run();
|
||||
|
||||
// Polls forever with SIGINT/SIGTERM unmasked.
|
||||
int poll(struct pollfd* fds, nfds_t nfds);
|
||||
// Polls forever with SIGINT/SIGTERM unmasked. If timeout < 0, waits forever.
|
||||
// If timeout == 0, returns immediately. If timeout > 0, it'll wait.
|
||||
int poll(struct pollfd* fds, nfds_t nfds, Duration timeout);
|
||||
|
||||
// Sleeps with SIGINT/SIGTERM unmasked.
|
||||
int sleep(Duration d);
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ EggsTime Xmon::_stepNextWakeup() {
|
||||
nextWakeup = std::min(nextWakeup, eggsNow() + HEARTBEAT_INTERVAL*2);
|
||||
}
|
||||
|
||||
if (poll(_fds, NUM_FDS) < 0) {
|
||||
if (poll(_fds, NUM_FDS, -1) < 0) {
|
||||
if (errno == EINTR) { return nextWakeup; }
|
||||
throw SYSCALL_EXCEPTION("poll");
|
||||
}
|
||||
|
||||
+1
-1
@@ -379,7 +379,7 @@ public:
|
||||
_sendVecs[i].clear();
|
||||
}
|
||||
|
||||
if (unlikely(poll(_shared.socks.data(), 1 + (_shared.socks[1].fd != 0)) < 0)) {
|
||||
if (unlikely(poll(_shared.socks.data(), 1 + (_shared.socks[1].fd != 0), -1) < 0)) {
|
||||
if (errno == EINTR) { return; }
|
||||
throw SYSCALL_EXCEPTION("poll");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user