Last change
on this file since 72 was 72, checked in by Bart Vastenhouw, 3 years ago |
Reduced memory need of websockets.
|
File size:
837 bytes
|
Line | |
---|
1 | from pyson.JsonGetter import JsonGetter
|
---|
2 |
|
---|
3 | from geniusweb.deadline.Deadline import Deadline
|
---|
4 |
|
---|
5 |
|
---|
6 | class DeadlineTime ( Deadline):
|
---|
7 | '''
|
---|
8 | How long a session will be allowed to run
|
---|
9 | '''
|
---|
10 |
|
---|
11 | def __init__(self, durationms:int ):
|
---|
12 | '''
|
---|
13 | @param durationms number of milliseconds the session will be allowed to run
|
---|
14 | '''
|
---|
15 | if durationms <= 0:
|
---|
16 | raise ValueError("deadline must be positive time");
|
---|
17 | self._durationms = durationms
|
---|
18 |
|
---|
19 | @JsonGetter("durationms")
|
---|
20 | def getDuration(self) -> int:
|
---|
21 | '''
|
---|
22 | @return the duration of this deadline, measured in milliseconds
|
---|
23 | '''
|
---|
24 | return self._durationms;
|
---|
25 |
|
---|
26 | def __repr__(self) -> str:
|
---|
27 | return "DeadlineTime[" + str(self._durationms) + "]";
|
---|
28 |
|
---|
29 |
|
---|
30 | def __hash__(self):
|
---|
31 | return hash(self._durationms)
|
---|
32 |
|
---|
33 | def __eq__(self, other):
|
---|
34 | return isinstance(other, self.__class__) \
|
---|
35 | and self._durationms == other._durationms
|
---|
36 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.