pyro: Return new proxy instances if called from outside of a request context.
This allows to run code that uses the pyro connection to the VCSServer but does not execute from within a request context, e.g. invoke tasks.
This commit is contained in:
parent
d29f7ba684
commit
64893dfad5
1 changed files with 10 additions and 1 deletions
|
|
@ -214,7 +214,16 @@ class RequestScopeProxyFactory(object):
|
|||
"""
|
||||
Call this to get the pyro proxy instance for the request.
|
||||
"""
|
||||
# Return already borrowed proxy for this request
|
||||
|
||||
# If called without a request context we return new proxy instances
|
||||
# on every call. This allows to run e.g. invoke tasks.
|
||||
if request is None:
|
||||
log.info('Creating pyro proxy without request context for '
|
||||
'remote_uri=%s', self._remote_uri)
|
||||
return Pyro4.Proxy(self._remote_uri)
|
||||
|
||||
# If there is an already borrowed proxy for the request context we
|
||||
# return that instance instead of creating a new one.
|
||||
if request in self._borrowed_proxies:
|
||||
return self._borrowed_proxies[request]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue