mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-08 18:45:13 +00:00
fix notmuch backend infinite loop (#329)
This commit is contained in:
parent
3899ec9c03
commit
984eb8c9f7
|
@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
- `In-Reply-To` not set properly when replying to a message [#323]
|
- `In-Reply-To` not set properly when replying to a message [#323]
|
||||||
- `Cc` missing or invalid when replying to a message [#324]
|
- `Cc` missing or invalid when replying to a message [#324]
|
||||||
|
- Notmuch backend hangs [#329]
|
||||||
|
|
||||||
## [0.5.8] - 2022-03-04
|
## [0.5.8] - 2022-03-04
|
||||||
|
|
||||||
|
@ -497,3 +498,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
[#321]: https://github.com/soywod/himalaya/issues/321
|
[#321]: https://github.com/soywod/himalaya/issues/321
|
||||||
[#323]: https://github.com/soywod/himalaya/issues/323
|
[#323]: https://github.com/soywod/himalaya/issues/323
|
||||||
[#324]: https://github.com/soywod/himalaya/issues/324
|
[#324]: https://github.com/soywod/himalaya/issues/324
|
||||||
|
[#329]: https://github.com/soywod/himalaya/issues/329
|
||||||
|
|
|
@ -26,7 +26,6 @@ impl IdMapper {
|
||||||
.open(&mapper.path)
|
.open(&mapper.path)
|
||||||
.context("cannot open id hash map file")?;
|
.context("cannot open id hash map file")?;
|
||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
|
|
||||||
for line in reader.lines() {
|
for line in reader.lines() {
|
||||||
let line =
|
let line =
|
||||||
line.context("cannot read line from maildir envelopes id mapper cache file")?;
|
line.context("cannot read line from maildir envelopes id mapper cache file")?;
|
||||||
|
@ -83,13 +82,13 @@ impl IdMapper {
|
||||||
|
|
||||||
for (hash, id) in self.iter() {
|
for (hash, id) in self.iter() {
|
||||||
loop {
|
loop {
|
||||||
let short_hash = &hash[0..self.short_hash_len];
|
let short_hash = &hash[0..short_hash_len];
|
||||||
let conflict_found = self
|
let conflict_found = self
|
||||||
.map
|
.map
|
||||||
.keys()
|
.keys()
|
||||||
.find(|cached_hash| cached_hash.starts_with(short_hash) && cached_hash != &hash)
|
.find(|cached_hash| cached_hash.starts_with(short_hash) && cached_hash != &hash)
|
||||||
.is_some();
|
.is_some();
|
||||||
if self.short_hash_len > 32 || !conflict_found {
|
if short_hash_len > 32 || !conflict_found {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
short_hash_len += 1;
|
short_hash_len += 1;
|
||||||
|
|
Loading…
Reference in a new issue