Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
shadowban-eu-backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
shadowban-eu-backend
Commits
f927ed09
Commit
f927ed09
authored
Dec 16, 2020
by
Raphael Beer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor: clearer names for shutdown/cleanup handlers
parent
af360ffc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
backend.py
backend.py
+7
-4
No files found.
backend.py
View file @
f927ed09
...
...
@@ -131,12 +131,12 @@ if args.debug is True:
else
:
set_log_level
(
'info'
)
async
def
close_sessions
(
app
):
async
def
shut_down
(
app
):
log
.
info
(
"Closing
%
s guest sessions"
%
len
(
TwitterSession
.
guest_sessions
))
for
session
in
TwitterSession
.
guest_sessions
:
await
session
.
close
()
async
def
cl
ose_database
(
app
):
async
def
cl
ean_up
(
app
):
global
db
log
.
info
(
"Closing database connection"
)
db
.
close
()
...
...
@@ -151,13 +151,16 @@ def run():
username
=
args
.
mongo_username
,
password
=
args
.
mongo_password
)
loop
=
asyncio
.
get_event_loop
()
loop
.
run_until_complete
(
login_accounts
(
accounts
,
args
.
cookie_dir
))
loop
.
run_until_complete
(
login_guests
())
app
=
web
.
Application
()
app
.
add_routes
(
routes
)
app
.
on_shutdown
.
append
(
close_sessions
)
app
.
on_cleanup
.
append
(
close_database
)
app
.
on_shutdown
.
append
(
shut_down
)
app
.
on_cleanup
.
append
(
clean_up
)
web
.
run_app
(
app
,
host
=
args
.
host
,
port
=
args
.
port
)
if
args
.
daemon
:
...
...
Write
Preview
Markdown
is supported
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