changeset 6799:5aa9fa97306f

lib: make the DaemonLock lock location parameter mandatory - the default was never used
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 12 Aug 2017 17:40:01 +0200
parents 6ca4f9f68eb5
children df5a67678b96
files kallithea/lib/celerylib/__init__.py kallithea/lib/celerylib/tasks.py kallithea/lib/paster_commands/make_index.py kallithea/lib/pidlock.py kallithea/tests/fixture.py
diffstat 5 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/celerylib/__init__.py	Sat Aug 12 17:40:01 2017 +0200
+++ b/kallithea/lib/celerylib/__init__.py	Sat Aug 12 17:40:01 2017 +0200
@@ -109,7 +109,7 @@
 
         log.info('running task with lockkey %s', lockkey)
         try:
-            l = DaemonLock(file_=os.path.join(lockkey_path, lockkey))
+            l = DaemonLock(os.path.join(lockkey_path, lockkey))
             ret = func(*fargs, **fkwargs)
             l.release()
             return ret
--- a/kallithea/lib/celerylib/tasks.py	Sat Aug 12 17:40:01 2017 +0200
+++ b/kallithea/lib/celerylib/tasks.py	Sat Aug 12 17:40:01 2017 +0200
@@ -82,7 +82,7 @@
     log.info('running task with lockkey %s', lockkey)
 
     try:
-        lock = l = celerylib.DaemonLock(file_=os.path.join(lockkey_path, lockkey))
+        lock = celerylib.DaemonLock(os.path.join(lockkey_path, lockkey))
 
         # for js data compatibility cleans the key for person from '
         akc = lambda k: person(k).replace('"', "")
--- a/kallithea/lib/paster_commands/make_index.py	Sat Aug 12 17:40:01 2017 +0200
+++ b/kallithea/lib/paster_commands/make_index.py	Sat Aug 12 17:40:01 2017 +0200
@@ -57,7 +57,7 @@
         from kallithea.lib.pidlock import LockHeld, DaemonLock
         from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
         try:
-            l = DaemonLock(file_=os.path.join(index_location, 'make_index.lock'))
+            l = DaemonLock(os.path.join(index_location, 'make_index.lock'))
             WhooshIndexingDaemon(index_location=index_location,
                                  repo_location=repo_location,
                                  repo_list=repo_list,
--- a/kallithea/lib/pidlock.py	Sat Aug 12 17:40:01 2017 +0200
+++ b/kallithea/lib/pidlock.py	Sat Aug 12 17:40:01 2017 +0200
@@ -28,18 +28,16 @@
     """daemon locking
     USAGE:
     try:
-        l = DaemonLock(file_='/path/tolockfile',desc='test lock')
+        l = DaemonLock('/path/tolockfile',desc='test lock')
         main()
         l.release()
     except LockHeld:
         sys.exit(1)
     """
 
-    def __init__(self, file_=None, callbackfn=None,
+    def __init__(self, file_, callbackfn=None,
                  desc='daemon lock', debug=False):
-
-        lock_name = os.path.join(os.path.dirname(__file__), 'running.lock')
-        self.pidfile = file_ if file_ else lock_name
+        self.pidfile = file_
         self.callbackfn = callbackfn
         self.desc = desc
         self.debug = debug
--- a/kallithea/tests/fixture.py	Sat Aug 12 17:40:01 2017 +0200
+++ b/kallithea/tests/fixture.py	Sat Aug 12 17:40:01 2017 +0200
@@ -411,7 +411,7 @@
     if not os.path.exists(index_location):
         os.makedirs(index_location)
 
-    l = DaemonLock(file_=os.path.join(index_location, 'make_index.lock'))
+    l = DaemonLock(os.path.join(index_location, 'make_index.lock'))
     WhooshIndexingDaemon(index_location=index_location,
                          repo_location=repo_location) \
         .run(full_index=full_index)