Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
Fix channel full codepath (#147)
Browse files Browse the repository at this point in the history
A bug was causing the buffer index to not properly update when
handling full channels; this is now fixed.
  • Loading branch information
codesections authored Apr 29, 2020
1 parent 2f07cf7 commit d2b9fbe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "flodgatt"
description = "A blazingly fast drop-in replacement for the Mastodon streaming api server"
version = "0.9.7"
version = "0.9.8"
authors = ["Daniel Long Sockwell <daniel@codesections.com", "Julian Laubstein <contact@julianlaubstein.de>"]
edition = "2018"

Expand Down
10 changes: 7 additions & 3 deletions src/response/redis/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,18 @@ impl Stream for Manager {
}
}
unread = msg.leftover_input;
self.unread_idx.0 = self.unread_idx.1 - unread.len();
}
Ok(NonMsg(leftover_input)) => {
unread = leftover_input;
self.unread_idx.0 = self.unread_idx.1 - unread.len();
}
Ok(NonMsg(leftover_input)) => unread = leftover_input,
Err(RedisParseErr::Incomplete) => {
self.copy_partial_msg();
unread = "";
break;
}
Err(e) => Err(Error::RedisParseErr(e, unread.to_string()))?,
};
self.unread_idx.0 = self.unread_idx.1 - unread.len();
}
if self.unread_idx.0 == self.unread_idx.1 {
self.unread_idx = (0, 0)
Expand All @@ -104,6 +107,7 @@ impl Manager {
self.redis_conn.input = self.redis_conn.input[self.unread_idx.0..].into();
}
self.unread_idx = (0, self.unread_idx.1 - self.unread_idx.0);
dbg!(&self.unread_idx);
}
/// Create a new `Manager`, with its own Redis connections (but no active subscriptions).
pub fn try_from(redis_cfg: &config::Redis) -> Result<Self> {
Expand Down

0 comments on commit d2b9fbe

Please sign in to comment.