This function is called in beforeSleep() in order to unblock clients * that are waiting in blocking operations with a timeout set. */
| 134 | /* This function is called in beforeSleep() in order to unblock clients |
| 135 | * that are waiting in blocking operations with a timeout set. */ |
| 136 | void handleBlockedClientsTimeout(void) { |
| 137 | if (raxSize(server.clients_timeout_table) == 0) return; |
| 138 | uint64_t now = mstime(); |
| 139 | raxIterator ri; |
| 140 | raxStart(&ri,server.clients_timeout_table); |
| 141 | raxSeek(&ri,"^",NULL,0); |
| 142 | |
| 143 | while(raxNext(&ri)) { |
| 144 | uint64_t timeout; |
| 145 | client *c; |
| 146 | decodeTimeoutKey(ri.key,&timeout,&c); |
| 147 | if (timeout >= now) break; /* All the timeouts are in the future. */ |
| 148 | c->flags &= ~CLIENT_IN_TO_TABLE; |
| 149 | checkBlockedClientTimeout(c,now); |
| 150 | raxRemove(server.clients_timeout_table,ri.key,ri.key_len,NULL); |
| 151 | raxSeek(&ri,"^",NULL,0); |
| 152 | } |
| 153 | raxStop(&ri); |
| 154 | } |
| 155 | |
| 156 | /* Get a timeout value from an object and store it into 'timeout'. |
| 157 | * The final timeout is always stored as milliseconds as a time where the |
no test coverage detected