Commit 539b0e8d authored by Oleg Borisenko's avatar Oleg Borisenko
Browse files

Fixed dumb error in shrinking queue conditions

parent 56abb0d5
......@@ -56,7 +56,7 @@ def form_wgs_queue(files_to_backup, free_space):
# important: since target is scanned in lexicographical order and we order by ID, previous file
# should always contain at least previous level of current file.
if current_file_folder_level <= 4:
while current_file_folder_level == prev_file_folder_level: # getting rid of all files from that level
if current_file_folder_level == prev_file_folder_level: # getting rid of all files from that level
queue_size -= i.fsize
files_to_exclude_from_queue += 1
if free_space <= queue_size:
......@@ -218,7 +218,6 @@ def rescan_backup_targets(dbsession):
def control_copy_queue(dbsession):
dbsession.begin_nested()
rescan_backup_targets(dbsession)
current_batch = models.Batch.get_current(dbsession) # there should be no more than 1 sum for new, in progress and interrupted
manager = utils.tapemanager.TapeManager(dbsession)
dbsession.begin_nested()
......@@ -312,10 +311,14 @@ def main(argv=sys.argv):
job_size = 50
iterations = 0
now = time.time()
with env['request'].tm:
dbsession = env['request'].dbsession
rescan_backup_targets(dbsession)
if flag.exit():
raise KeyboardInterrupt("Gracefully stopped after rescan.")
with env['request'].tm:
if flag.exit():
raise KeyboardInterrupt("Gracefully stopped before rescan.")
raise KeyboardInterrupt("Gracefully stopped before queue form.")
dbsession = env['request'].dbsession
queue_len = control_copy_queue(dbsession)
if flag.exit():
......
......@@ -170,7 +170,9 @@ def tapes_route(request):
@view_config(route_name="files", renderer='tapebackup:templates/files.jinja2')
def files_route(request):
limit = request.GET.get('limit') or 100
limit = int(limit)
page = request.GET.get('page') or 0
page = int(page)
files = request.dbsession.query(models.FileToBackup).filter(models.FileToBackup.is_file == True)
tape_label = request.GET.get('tape_label')
if tape_label:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment