Browse Source

Make backup names use the log path slug and clean up initPool logic

Nathaniel van Diepen 4 years ago
parent
commit
2afb5f838f
1 changed files with 5 additions and 5 deletions
  1. 5 5
      backup.py

+ 5 - 5
backup.py

@@ -68,16 +68,16 @@ class Job(object):
     def initPool():
         if Job.pool:
             maxthreads = Job.maxthreads
-            queued = Job.queued()
             running = len(Job.running())
             if maxthreads > running:
+                queued = Job.queued()
                 if len(queued) < maxthreads - running:
                     maxthreads = len(queued)
 
                 if maxthreads:
                     for i in range(0, maxthreads):
-                        print(queued[i])
-                        queued[i].start()
+                        if len(queued) > i:
+                            queued[i].start()
 
     @staticmethod
     def finished():
@@ -332,9 +332,9 @@ class Backup(object):
     def __init__(self, config):
         self._config = config
         self._path = self._config['path']
-        self._name = os.path.basename(self._path)
+        self._name = slugify(self._path, max_length=255)
         self._logpath = os.path.realpath(os.path.join(
-                Backup.logdir, slugify(self._path), 'backup.log'))
+                Backup.logdir, self.name, 'backup.log'))
         self._status = Backup.READY
         if self.blocking:
             self.setStatus(Backup.BLOCKED)