aboutsummaryrefslogtreecommitdiffstats
path: root/common/queue.py
blob: 7804c8dc5cd26b71d87fbe6da0d6dd6084bf0553 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3
''' common functions and stuff '''

import os
import sys
import pickle
from litequeue import SQLQueue

QUEUE_DB = os.environ.get('el_QUEUE_db', 'litequeue.db')

# Initialize queue
q = SQLQueue(QUEUE_DB, maxsize=None)

def dbi(sql,values,**kwargs):
    print("lolqu")
    verbose = bool(kwargs['verbose']) if 'verbose' in kwargs else False

    q.put(pickle.dumps([sql, values]))
    if verbose is True:
        print("Inserted into queue")
    return True