Commit 82ef861e authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

pgpubsub added, channel listener added

parent b6822327
import pgpubsub
from app import app
from uwsgidecorators import thread
@thread
def listening():
ps = pgpubsub.connect(
database = app.config['DB_NAME'],
user = app.config['DB_USERNAME'],
password = app.config['DB_PASSWORD'],
host = app.config['DB_HOST'],
port = app.config['DB_PORT']
)
ps.listen('test')
while True:
for e in ps.events():
print(e.payload)
listening()
...@@ -8,6 +8,7 @@ Flask-Mail==0.9.1 ...@@ -8,6 +8,7 @@ Flask-Mail==0.9.1
itsdangerous==1.1.0 itsdangerous==1.1.0
Jinja2==2.11.2 Jinja2==2.11.2
MarkupSafe==1.1.1 MarkupSafe==1.1.1
pgpubsub==0.0.5
psycopg2==2.8.5 psycopg2==2.8.5
pycparser==2.20 pycparser==2.20
pytz==2019.3 pytz==2019.3
......
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