Write-lock when refiltering
This commit is contained in:
parent
c502aa4245
commit
0e49b5f972
1
TODO.md
1
TODO.md
|
@ -11,6 +11,7 @@
|
||||||
- fix left rooms opacity
|
- fix left rooms opacity
|
||||||
- fix escape keybinds (filter rooms, message selection)
|
- fix escape keybinds (filter rooms, message selection)
|
||||||
- fix nio 429
|
- fix nio 429
|
||||||
|
- fix python getting stuck when loading large room
|
||||||
|
|
||||||
- account delegates refactor
|
- account delegates refactor
|
||||||
- lag when switching accounts
|
- lag when switching accounts
|
||||||
|
|
|
@ -55,23 +55,24 @@ class ModelFilter(ModelProxy):
|
||||||
|
|
||||||
|
|
||||||
def refilter(self) -> None:
|
def refilter(self) -> None:
|
||||||
take_out = []
|
with self._write_lock:
|
||||||
bring_back = []
|
take_out = []
|
||||||
|
bring_back = []
|
||||||
|
|
||||||
for key, item in sorted(self.items(), key=lambda kv: kv[1]):
|
for key, item in sorted(self.items(), key=lambda kv: kv[1]):
|
||||||
if not self.accept_item(item):
|
if not self.accept_item(item):
|
||||||
take_out.append(key)
|
take_out.append(key)
|
||||||
|
|
||||||
for key, item in self.filtered_out.items():
|
for key, item in self.filtered_out.items():
|
||||||
if self.accept_item(item):
|
if self.accept_item(item):
|
||||||
bring_back.append(key)
|
bring_back.append(key)
|
||||||
|
|
||||||
with self.batch_remove():
|
with self.batch_remove():
|
||||||
for key in take_out:
|
for key in take_out:
|
||||||
self.filtered_out[key] = self.pop(key)
|
self.filtered_out[key] = self.pop(key)
|
||||||
|
|
||||||
for key in bring_back:
|
for key in bring_back:
|
||||||
self[key] = self.filtered_out.pop(key)
|
self[key] = self.filtered_out.pop(key)
|
||||||
|
|
||||||
|
|
||||||
class FieldSubstringFilter(ModelFilter):
|
class FieldSubstringFilter(ModelFilter):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user