Skip to content

Commit 440cc2b

Browse files
Merge pull request #6787 from roed314/proddb_ongoing_ops
Don't update ongoing operations on proddb
2 parents 1cfa8c7 + 29cc30c commit 440cc2b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lmfdb/lmfdb_database.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import shutil
44
import signal
5+
import socket
56
import subprocess
67
from collections import Counter
78
from psycopg2.sql import SQL
@@ -317,7 +318,7 @@ def _check_locks(self, changetype, datafile=None, suffix=""):
317318
super()._check_locks(changetype, datafile=datafile, suffix=suffix)
318319
if self._db.config.postgresql_options["user"] != "editor":
319320
raise RuntimeError("You must be logged in as editor to make data changes")
320-
if changetype in _nolog_changetypes:
321+
if changetype in _nolog_changetypes or socket.gethostname() == "proddb":
321322
return
322323

323324
# The following is the definition of run_diskfree used below to find the available space on grace
@@ -511,8 +512,9 @@ def log_db_change(self, operation, tablename=None, logid=None, aborted=False, **
511512
- ``**data`` -- any additional information to install in the logging table (will be stored as a json dictionary)
512513
"""
513514
if aborted:
514-
deleter = SQL("DELETE FROM userdb.ongoing_operations WHERE logid = %s")
515-
self._execute(deleter, [logid])
515+
if socket.gethostname() != "proddb":
516+
deleter = SQL("DELETE FROM userdb.ongoing_operations WHERE logid = %s")
517+
self._execute(deleter, [logid])
516518
else:
517519
from lmfdb.utils.datetime_utils import utc_now_naive
518520
uid = self.login()
@@ -522,7 +524,7 @@ def log_db_change(self, operation, tablename=None, logid=None, aborted=False, **
522524
"VALUES (%s, %s, %s, %s, %s, %s)"
523525
)
524526
self._execute(inserter, [uid, utc_now_naive(), tablename, logid, operation, data])
525-
if operation not in _nolog_changetypes:
527+
if operation not in _nolog_changetypes and socket.gethostname() != "proddb":
526528
# This table is used by _check_locks to determine if there is enough space to execute an upload
527529
inserter = SQL(
528530
"INSERT INTO userdb.ongoing_operations (logid, finishing, time, tablename, operation, username) "

0 commit comments

Comments
 (0)