Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TSRh
gajim
Commits
145db1a1
Commit
145db1a1
authored
18 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
save jid_id in unread_messages table too to increase speed (it was definitively too slow)
parent
4b43cda8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/check_paths.py
+2
-1
2 additions, 1 deletion
src/common/check_paths.py
src/common/logger.py
+16
-10
16 additions, 10 deletions
src/common/logger.py
with
18 additions
and
11 deletions
src/common/check_paths.py
+
2
−
1
View file @
145db1a1
...
...
@@ -43,7 +43,8 @@ def assert_unread_msgs_table_exists():
cur
.
executescript
(
'''
CREATE TABLE unread_messages (
message_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE
message_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
jid_id INTEGER
);
'''
)
...
...
This diff is collapsed.
Click to expand it.
src/common/logger.py
+
16
−
10
View file @
145db1a1
...
...
@@ -206,12 +206,12 @@ def commit_to_db(self, values, write_unread = False):
except
sqlite
.
OperationalError
,
e
:
print
>>
sys
.
stderr
,
str
(
e
)
if
message_id
:
self
.
insert_unread_events
(
message_id
)
self
.
insert_unread_events
(
message_id
,
values
[
0
]
)
return
message_id
def
insert_unread_events
(
self
,
message_id
):
def
insert_unread_events
(
self
,
message_id
,
jid_id
):
'''
add unread message with id: message_id
'''
sql
=
'
INSERT INTO unread_messages VALUES (%d)
'
%
message_id
sql
=
'
INSERT INTO unread_messages VALUES (
%d,
%d)
'
%
(
message_id
,
jid_id
)
self
.
cur
.
execute
(
sql
)
try
:
self
.
con
.
commit
()
...
...
@@ -234,14 +234,20 @@ def get_unread_msgs_for_jid(self, jid):
return
jid
=
jid
.
lower
()
jid_id
=
self
.
get_jid_id
(
jid
)
self
.
cur
.
execute
(
'''
SELECT message_id, message, time, subject FROM logs, unread_messages
WHERE jid_id = %d AND log_line_id = message_id ORDER BY time ASC
'''
%
(
jid_id
)
)
all_messages
=
[]
self
.
cur
.
execute
(
'
SELECT message_id from unread_messages WHERE jid_id = %d
'
%
jid_id
)
results
=
self
.
cur
.
fetchall
()
return
results
for
message
in
results
:
msg_id
=
message
[
0
]
self
.
cur
.
execute
(
'''
SELECT log_line_id, message, time, subject FROM logs
WHERE jid_id = %d AND log_line_id = %d
'''
%
(
jid_id
,
msg_id
)
)
results
=
self
.
cur
.
fetchall
()
all_messages
.
append
(
results
[
0
])
return
all_messages
def
write
(
self
,
kind
,
jid
,
message
=
None
,
show
=
None
,
tim
=
None
,
subject
=
None
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment