mirror of
https://github.com/markqvist/Sideband.git
synced 2025-08-02 03:26:25 -04:00
Improved announce stream UI performance
This commit is contained in:
parent
783f0d573a
commit
715d4e27a4
3 changed files with 65 additions and 22 deletions
|
@ -622,18 +622,22 @@ class SidebandCore():
|
|||
return None
|
||||
else:
|
||||
announces = []
|
||||
added_dests = []
|
||||
for entry in result:
|
||||
try:
|
||||
announce = {
|
||||
"dest": entry[2],
|
||||
"data": entry[3].decode("utf-8"),
|
||||
"time": entry[1],
|
||||
"type": entry[4]
|
||||
}
|
||||
announces.append(announce)
|
||||
if not entry[2] in added_dests:
|
||||
announce = {
|
||||
"dest": entry[2],
|
||||
"data": entry[3].decode("utf-8"),
|
||||
"time": entry[1],
|
||||
"type": entry[4]
|
||||
}
|
||||
added_dests.append(entry[2])
|
||||
announces.append(announce)
|
||||
except Exception as e:
|
||||
RNS.log("Exception while fetching announce from DB: "+str(e), RNS.LOG_ERROR)
|
||||
|
||||
announces.reverse()
|
||||
return announces
|
||||
|
||||
def _db_conversation(self, context_dest):
|
||||
|
@ -855,6 +859,9 @@ class SidebandCore():
|
|||
db = sqlite3.connect(self.db_path)
|
||||
dbc = db.cursor()
|
||||
|
||||
query = "delete from announce where (source=:source);"
|
||||
dbc.execute(query, {"source": destination_hash})
|
||||
|
||||
query = "INSERT INTO announce (received, source, data, dest_type) values (?, ?, ?, ?)"
|
||||
data = (
|
||||
time.time(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue