Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden
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
Container 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pavel Valach
Warden
Commits
c6220244
Commit
c6220244
authored
7 years ago
by
Pavel Kácha
Browse files
Options
Downloads
Patches
Plain Diff
Update to more strict MySQLdb API (thx to bodik@cesnet.cz)
parent
5bd0ea9c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
warden3/warden_server/warden_server.py
+7
-7
7 additions, 7 deletions
warden3/warden_server/warden_server.py
with
7 additions
and
7 deletions
warden3/warden_server/warden_server.py
+
7
−
7
View file @
c6220244
...
...
@@ -757,7 +757,7 @@ class MySQL(ObjectBase):
def
getLastReceivedId
(
self
,
client
):
res
=
self
.
query
(
"
SELECT event_id as id FROM last_events WHERE client_id = %s ORDER BY last_events.id DESC LIMIT 1
"
,
client
.
id
,
commit
=
True
).
fetchall
()
res
=
self
.
query
(
"
SELECT event_id as id FROM last_events WHERE client_id = %s ORDER BY last_events.id DESC LIMIT 1
"
,
(
client
.
id
,
),
commit
=
True
).
fetchall
()
try
:
row
=
res
[
0
]
except
IndexError
:
...
...
@@ -791,15 +791,15 @@ class MySQL(ObjectBase):
def
purge_lastlog
(
self
,
days
):
try
:
self
.
query
(
crs
=
self
.
query
(
"
DELETE FROM last_events
"
"
USING last_events LEFT JOIN (
"
"
SELECT MAX(id) AS last FROM last_events
"
"
GROUP BY client_id
"
"
) AS maxids ON last=id
"
"
WHERE timestamp < DATE_SUB(CURDATE(), INTERVAL %s DAY) AND last IS NULL
"
,
days
)
affected
=
self
.
con
.
affected_rows
()
(
days
,)
)
affected
=
crs
.
rowcount
self
.
con
.
commit
()
except
Exception
as
e
:
self
.
con
.
rollback
()
...
...
@@ -809,10 +809,10 @@ class MySQL(ObjectBase):
def
purge_events
(
self
,
days
):
try
:
self
.
query
(
crs
=
self
.
query
(
"
DELETE FROM events WHERE received < DATE_SUB(CURDATE(), INTERVAL %s DAY)
"
,
days
)
affected
=
self
.
con
.
affected_rows
()
(
days
,)
)
affected
=
crs
.
rowcount
self
.
con
.
commit
()
except
Exception
as
e
:
self
.
con
.
rollback
()
...
...
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