Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
82ef861e
Commit
82ef861e
authored
Jun 03, 2020
by
Vladislav Rykov
Browse files
pgpubsub added, channel listener added
parent
b6822327
Changes
3
Show whitespace changes
Inline
Side-by-side
app/app/helpers/__pycache__/notification_manager.cpython-37.pyc
0 → 100644
View file @
82ef861e
File added
app/app/helpers/notification_manager.py
0 → 100644
View file @
82ef861e
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
()
app/requirements.txt
View file @
82ef861e
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment