Repository navigation
Conversation
Collaborator
Author
Not sure why those started failing, they pass locally 🤔 |
byroot
force-pushed
the
deadline
branch
2 times, most recently
from
November 20, 2026 11:35
44de62d to
2d4ebc0
Compare
Timeouts are useful to avoid blocking too long on an unresponsive
server, but they're impractical to ensure that a unit of work
(e.g. a web request) complete within a a reasonable timeline,
since they only cap how long a given query can take, not how many
queries you can issue as part of that unit of work.
In addition, in Trilogy the timeouts only consider individual reads
and write, so a query can actually take much longer than the specified
timeout if it involve multiple reads and writes.
Hence the concept of deadline is useful, it allow to keep track
of the absolute time at which we'd rather give up than continue.
Example:
```ruby
class Deadline
def initialize(timeout)
@ends_at = Time.now.to_f + timeout
end
def remaining
@ends_at - Time.now.to_f
end
end
deadline = Deadline.new(10)
client.query('...', deadline: deadline.remaining)
client.query('...', deadline: deadline.remaining)
client.query('...', deadline: deadline.remaining)
```
Collaborator
Author
|
I can't reproduce these SEGV locally, even using |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Timeouts are useful to avoid blocking too long on an unresponsive server, but they're impractical to ensure that a unit of work (e.g. a web request) complete within a a reasonable timeline, since they only cap how long a given query can take, not how many queries you can issue as part of that unit of work.
In addition, in Trilogy the timeouts only consider individual reads and write, so a query can actually take much longer than the specified timeout if it involve multiple reads and writes.
Hence the concept of deadline is useful, it allow to keep track of the absolute time at which we'd rather give up than continue.
Example:
Ref: rails/rails#59822