Skip to content

Commit

Permalink
Make linter happy. Refactor misc.queue...
Browse files Browse the repository at this point in the history
  • Loading branch information
stas committed Jul 16, 2020
1 parent 83f2f05 commit 0e0b5f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion api_v3/management/commands/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from django.core.management.base import BaseCommand
from django.conf import settings
from django.db import connection
from api_v3.models.queue_job import QueueJob, queue


Expand Down
9 changes: 4 additions & 5 deletions api_v3/misc/queue.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from django.conf import settings
from pq.tasks import PQ
from psycopg2.errors import DuplicateTable
from psycopg2.errors import UndefinedTable
from psycopg2.pool import ThreadedConnectionPool


pool = ThreadedConnectionPool(1, 5, settings.QUEUE_DATABASE_URL)
pq = PQ(pool=pool)
queue = pq[settings.QUEUE_NAME]

try:
len(queue)
except UndefinedTable:
pq.create()
except DuplicateTable:
pass

queue = pq[settings.QUEUE_NAME]
1 change: 0 additions & 1 deletion api_v3/models/queue_job.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.db import models
from django.conf import settings
from django.contrib.postgres.fields import JSONField

from api_v3.misc.queue import queue
Expand Down

0 comments on commit 0e0b5f9

Please sign in to comment.