Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'collective/master'
- Loading branch information
Showing
12 changed files
with
92 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" Async | ||
""" | ||
from zope.interface import Interface | ||
|
||
try: | ||
from plone.app.async.interfaces import IAsyncService | ||
except ImportError: | ||
class IAsyncService(Interface): | ||
""" No async """ | ||
|
||
__all__ = [ | ||
IAsyncService.__name__, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<configure | ||
xmlns="http://namespaces.zope.org/zope" | ||
xmlns:zcml="http://namespaces.zope.org/zcml" | ||
i18n_domain="eea"> | ||
|
||
<configure zcml:condition="installed plone.app.async"> | ||
<subscriber | ||
for="plone.app.async.interfaces.IQueueReady" | ||
handler=".subscribers.configureQueue" | ||
/> | ||
</configure> | ||
|
||
</configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
""" Subscribers | ||
""" | ||
import os | ||
import logging | ||
from plone.app.async.subscribers import set_quota | ||
logger = logging.getLogger('eea.relations') | ||
|
||
|
||
def getMaximumThreads(queue): | ||
""" Get the maximum threads per queue | ||
""" | ||
size = 0 | ||
for da in queue.dispatchers.values(): | ||
if not da.activated: | ||
continue | ||
for _agent in da.values(): | ||
size += 3 | ||
return size or 1 | ||
|
||
|
||
def configureQueue(event): | ||
""" Configure zc.async queue for rdf async jobs | ||
""" | ||
queue = event.object | ||
|
||
try: | ||
size = int(os.environ.get( | ||
'EEARELATIONS_ASYNC_THREADS', getMaximumThreads(queue))) | ||
except Exception, err: | ||
logger.exception(err) | ||
size = 1 | ||
|
||
set_quota(queue, 'relations', size=size) | ||
logger.info("quota 'relations' with size %r configured in queue %r.", | ||
size, queue.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
9.7.dev0 | ||
9.8.dev0 |