Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Removed the call to purge() on the timer that kills queries that over…
Browse files Browse the repository at this point in the history
…run their timeout.

We were calling it for every task, and it's linear in the number of tasks, and synchronized
on the timer's monitor, so it was effectively quadratic on the number of pending tasks.

It turns out that we don't need to call purge() at all anyway...
  • Loading branch information
Benjy Weinberger committed Jan 5, 2011
1 parent 89dfacd commit 315f6a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/scala/com/twitter/querulous/Timeout.scala
Expand Up @@ -23,7 +23,9 @@ object Timeout {
} finally {
task map { t =>
t.cancel()
timer.purge()
// TODO(benjy): Timer is not optimized to deal with large numbers of cancellations: it releases and reacquires its monitor
// on every task, cancelled or not, when it could quickly skip over all cancelled tasks in a single monitor region.
// This may not be a problem, but it's something to be aware of.
}
if (cancelled) throw new TimeoutException
}
Expand Down

0 comments on commit 315f6a1

Please sign in to comment.