aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2021-06-08 15:18:45 +0000
committerIsaac Freund <ifreund@ifreund.xyz>2021-06-08 15:18:45 +0000
commit68267a4cfedf35065f9619751ecd89de6c47f5db (patch)
tree9487a718f07500053ae3d2170dfe7c7fd059ec96
parente90474657fd83ef55575154cb3d0ff103249ccad (diff)
downloadriver-68267a4cfedf35065f9619751ecd89de6c47f5db.tar.gz
river-68267a4cfedf35065f9619751ecd89de6c47f5db.tar.xz
river: don't extend timeout on transaction preemption
This avoids locking up the compositor if a client is unresponsive and the user continuously initiates new transactions through their actions.
-rw-r--r--river/Root.zig23
1 files changed, 13 insertions, 10 deletions
diff --git a/river/Root.zig b/river/Root.zig
index 2431bda..5f600e2 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -282,6 +282,7 @@ pub fn startTransaction(self: *Self) void {
// If a new transaction is started while another is in progress, we need
// to reset the pending count to 0 and clear serials from the views
+ const preempting = self.pending_configures > 0;
self.pending_configures = 0;
// Iterate over all views of all outputs
@@ -317,16 +318,18 @@ pub fn startTransaction(self: *Self) void {
}
if (self.pending_configures > 0) {
- std.log.scoped(.transaction).debug(
- "started transaction with {} pending configure(s)",
- .{self.pending_configures},
- );
-
- // Set timeout to 200ms
- self.transaction_timer.timerUpdate(200) catch {
- std.log.scoped(.transaction).err("failed to update timer", .{});
- self.commitTransaction();
- };
+ std.log.scoped(.transaction).debug("started transaction with {} pending configure(s)", .{
+ self.pending_configures,
+ });
+
+ // Timeout the transaction after 200ms. If we are preempting an
+ // already in progress transaction, don't extend the timeout.
+ if (!preempting) {
+ self.transaction_timer.timerUpdate(200) catch {
+ std.log.scoped(.transaction).err("failed to update timer", .{});
+ self.commitTransaction();
+ };
+ }
} else {
// No views need configures, clear the current timer in case we are
// interrupting another transaction and commit.