Beispiel #1
0
 def async_request(self, handler, *args, **kwargs):
     """send a request and return an AsyncResult object, which will
     eventually hold the reply"""
     timeout = kwargs.pop("timeout", None)
     if kwargs:
         raise TypeError("got unexpected keyword argument %r" % (kwargs.keys()[0],))
     res = AsyncResult(weakref.proxy(self))
     self._async_request(handler, args, res)
     if timeout is not None:
         res.set_expiry(timeout)
     return res
Beispiel #2
0
 def async_request(self, handler, *args, **kwargs):
     """send a request and return an AsyncResult object, which will
     eventually hold the reply"""
     timeout = kwargs.pop("timeout", None)
     if kwargs:
         raise TypeError("got unexpected keyword argument %r" %
                         (kwargs.keys()[0], ))
     res = AsyncResult(weakref.proxy(self))
     self._async_request(handler, args, res)
     if timeout is not None:
         res.set_expiry(timeout)
     return res
Beispiel #3
0
    def async_request(self, handler, *args, **kwargs):
        """Send an asynchronous request (does not wait for it to finish)

        :returns: an :class:`rpyc.core.async.AsyncResult` object, which will
                  eventually hold the result (or exception)
        """
        timeout = kwargs.pop("timeout", None)
        if kwargs:
            raise TypeError("got unexpected keyword argument(s) %s" % (list(kwargs.keys()),))
        res = AsyncResult(weakref.proxy(self))
        self._async_request(handler, args, res)
        if timeout is not None:
            res.set_expiry(timeout)
        return res
Beispiel #4
0
 def async_request(self, handler, *args, **kwargs):
     """Send an asynchronous request (does not wait for it to finish)
     
     :returns: an :class:`rpyc.core.async.AsyncResult` object, which will
               eventually hold the result (or exception)
     """
     timeout = kwargs.pop("timeout", None)
     if kwargs:
         raise TypeError("got unexpected keyword argument(s) %s" % (list(kwargs.keys()),))
     res = AsyncResult(weakref.proxy(self))
     self._async_request(handler, args, res.async_assign)
     if timeout is not None:
         res.set_expiry(timeout)
     return res
Beispiel #5
0
    def async_request(self, handler, *args, **kw):
        """
        Override async request handling to intercept outgoing deletion requests because we cache
        certain things, and if we allow deletion of cached things our cache becomes stale.
        We can clean the cache upon deletion, but it would increase cache misses a lot.

        Also note that memory is not leaked forever, RPyC frees all of it upon disconnect.
        """
        if handler == consts.HANDLE_DEL:
            obj, _ = args
            if obj.____id_pack__ in self._static_cache:
                # object is cached by us, so ignore the request or remote end dies and cache is suddenly stale;
                # we shouldn't remove item from cache as it would reduce performance
                res = AsyncResult(self)
                res._is_ready = True  # simulate finished async request
                return res
        return super().async_request(handler, *args, **kw)