Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
3bbec18a
Commit
3bbec18a
authored
Feb 28, 2016
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #734 from yodax/dynamicpool
Create a temporary multiprocessing pool
parents
fc5c1986
f53d3bc3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
daemon.py
management/daemon.py
+4
-7
No files found.
management/daemon.py
View file @
3bbec18a
...
...
@@ -6,17 +6,11 @@ from functools import wraps
from
flask
import
Flask
,
request
,
render_template
,
abort
,
Response
,
send_from_directory
import
auth
,
utils
import
auth
,
utils
,
multiprocessing
.
pool
from
mailconfig
import
get_mail_users
,
get_mail_users_ex
,
get_admins
,
add_mail_user
,
set_mail_password
,
remove_mail_user
from
mailconfig
import
get_mail_user_privileges
,
add_remove_mail_user_privilege
from
mailconfig
import
get_mail_aliases
,
get_mail_aliases_ex
,
get_mail_domains
,
add_mail_alias
,
remove_mail_alias
# Create a worker pool for the status checks. The pool should
# live across http requests so we don't baloon the system with
# processes.
import
multiprocessing.pool
pool
=
multiprocessing
.
pool
.
Pool
(
processes
=
5
)
env
=
utils
.
load_environment
()
auth_service
=
auth
.
KeyAuthService
()
...
...
@@ -436,7 +430,10 @@ def system_status():
def
print_line
(
self
,
message
,
monospace
=
False
):
self
.
items
[
-
1
][
"extra"
]
.
append
({
"text"
:
message
,
"monospace"
:
monospace
})
output
=
WebOutput
()
# Create a temporary pool of processes for the status checks
pool
=
multiprocessing
.
pool
.
Pool
(
processes
=
5
)
run_checks
(
False
,
env
,
output
,
pool
)
pool
.
terminate
()
return
json_response
(
output
.
items
)
@
app
.
route
(
'/system/updates'
)
...
...
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