canonical / dqlite

Embeddable, replicated and fault-tolerant SQL engine.
https://dqlite.io
Other
3.83k stars 216 forks source link

client/protocol: Switch context from budget to deadline #490

Closed cole-miller closed 1 year ago

cole-miller commented 1 year ago

That is, instead of tracking a duration that upper-bounds the time we spend waiting in poll(2), we track an instant and return early if that instant has passed when we're about to poll. This is how Go does it, and for good reason: with the duration-based approach, it's impractical to track time that elapses while doing things other than polling for socket readiness (or waiting for some other blocking syscall to complete). I realized that this is important while working on #480, which needs to call these client functions in an asynchronous context where lots of other stuff is going on besides client/server message exchange.

Signed-off-by: Cole Miller cole.miller@canonical.com

codecov[bot] commented 1 year ago

Codecov Report

Merging #490 (09927c5) into master (d80745b) will increase coverage by 0.30%. The diff coverage is 37.50%.

@@            Coverage Diff             @@
##           master     #490      +/-   ##
==========================================
+ Coverage   58.80%   59.10%   +0.30%     
==========================================
  Files          33       33              
  Lines        5916     5906      -10     
  Branches     1776     1769       -7     
==========================================
+ Hits         3479     3491      +12     
+ Misses       1359     1342      -17     
+ Partials     1078     1073       -5     
Impacted Files Coverage Δ
src/client/protocol.c 34.88% <37.50%> (+1.22%) :arrow_up:

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.