Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion hazelcast/reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import sys
import threading
import time
from hazelcast.six.moves import queue
from collections import deque
from functools import total_ordering

from hazelcast.six.moves import queue

from hazelcast.connection import Connection, BUFFER_SIZE
from hazelcast.exception import HazelcastError
Expand Down Expand Up @@ -191,6 +193,7 @@ def close(self, cause):
self._connection_closed_callback(self, cause)


@total_ordering
class Timer(object):
canceled = False

Expand All @@ -199,6 +202,15 @@ def __init__(self, end, timer_ended_cb, timer_canceled_cb):
self.timer_ended_cb = timer_ended_cb
self.timer_canceled_cb = timer_canceled_cb

def __eq__(self, other):
return self.end == other.end

def __ne__(self, other):
return not (self == other)

def __lt__(self, other):
return self.end < other.end

def cancel(self):
self.canceled = True
self.timer_canceled_cb(self)
Expand Down