Commit b459d85f authored by Vincent Pelletier's avatar Vincent Pelletier

lib.connection: use standard python library class instead of OnTimeout.

Update (only) user.
parent e4601dc0
......@@ -20,6 +20,7 @@ from neo.lib.locking import Empty
from random import shuffle
import heapq
import time
from functools import partial
from ZODB.POSException import UndoError, StorageTransactionError, ConflictError
from ZODB.POSException import ReadConflictError
......@@ -32,7 +33,7 @@ from neo.lib.protocol import NodeTypes, Packets, \
from neo.lib.event import EventManager
from neo.lib.util import makeChecksum as real_makeChecksum, dump
from neo.lib.locking import Lock
from neo.lib.connection import MTClientConnection, OnTimeout, ConnectionClosed
from neo.lib.connection import MTClientConnection, ConnectionClosed
from neo.lib.node import NodeManager
from neo.lib.connector import getConnectorHandler
from .exception import NEOStorageError, NEOStorageCreationUndoneError
......@@ -530,7 +531,11 @@ class Application(object):
compressed_data = data
checksum = makeChecksum(compressed_data)
txn_context['data_size'] += size
on_timeout = OnTimeout(self.onStoreTimeout, txn_context, oid)
on_timeout = partial(
self.onStoreTimeout,
txn_context=txn_context,
oid=oid,
)
# Store object in tmp cache
txn_context['data_dict'][oid] = data
# Store data on each node
......
......@@ -62,19 +62,6 @@ def lockCheckWrapper(func):
return func(self, *args, **kw)
return wraps(func)(wrapper)
class OnTimeout(object):
"""
Simple helper class for on_timeout parameter used in HandlerSwitcher
class.
"""
def __init__(self, func, *args, **kw):
self.func = func
self.args = args
self.kw = kw
def __call__(self, conn, msg_id):
return self.func(conn, msg_id, *self.args, **self.kw)
class HandlerSwitcher(object):
_next_timeout = None
_next_timeout_msg_id = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment