disable offline logging when Python was not compiled with sqlite3 module
This commit is contained in:
parent
5303f25614
commit
cedfa30a27
1 changed files with 9 additions and 1 deletions
|
@ -13,9 +13,13 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
|
||||||
import traceback
|
import traceback
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
try:
|
||||||
|
import sqlite3
|
||||||
|
HAS_SQL = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_SQL = False
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -41,6 +45,8 @@ class Queue(object):
|
||||||
|
|
||||||
|
|
||||||
def push(self, data, plugin):
|
def push(self, data, plugin):
|
||||||
|
if not HAS_SQL:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
conn, c = self.connect()
|
conn, c = self.connect()
|
||||||
action = {
|
action = {
|
||||||
|
@ -61,6 +67,8 @@ class Queue(object):
|
||||||
|
|
||||||
|
|
||||||
def pop(self):
|
def pop(self):
|
||||||
|
if not HAS_SQL:
|
||||||
|
return None
|
||||||
tries = 3
|
tries = 3
|
||||||
wait = 0.1
|
wait = 0.1
|
||||||
action = None
|
action = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue