From 4ad7f2e5111ca9e27dcbe5781c87f249bc7377ad Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Thu, 9 Nov 2023 13:57:26 +0100 Subject: added new function to get env which handles missing env better... --- scripts/queue_runner.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'scripts/queue_runner.py') diff --git a/scripts/queue_runner.py b/scripts/queue_runner.py index fd88600..0fdb80d 100644 --- a/scripts/queue_runner.py +++ b/scripts/queue_runner.py @@ -1,20 +1,18 @@ #!/usr/bin/env python3 """ move items from queue to database """ -import os import pickle import sqlite3 import time +import common from common.postgres import dbi from litequeue import SQLQueue -QUEUE_DB = os.environ.get("el_QUEUE_db", "litequeue.db") -QUEUE_DIR = os.environ.get("el_QUEUE_dir", "queue") +QUEUE_DB = common.env("el_QUEUE_db", "litequeue.db") +QUEUE_DIR = common.env("el_QUEUE_dir", "queue") QUEUE_DB = QUEUE_DIR + "/" + QUEUE_DB -QUEUE_SLEEP = int( - os.environ.get("el_QUEUE_sleep", 15) -) # Default sleep 15 seconds when queue empty +QUEUE_SLEEP = int(common.env("el_QUEUE_sleep", 15)) # Default sleep 15 seconds when queue empty # Unlock all con = sqlite3.connect(QUEUE_DB) -- cgit v1.2.3