Skip to content

Commit

Permalink
introduce last_active in SequenceInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Charbonnier committed Feb 19, 2024
1 parent 671cf8a commit f82fe98
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions nats/js/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,18 @@ def as_dict(self) -> Dict[str, object]:
class SequenceInfo(Base):
consumer_seq: int
stream_seq: int
# FIXME: Do not handle dates for now.
# last_active: Optional[datetime]
last_active: Optional[datetime.datetime] = None

@classmethod
def from_response(cls, resp: Dict[str, Any]):
cls._convert_rfc3339(resp, 'last_active')
return super().from_response(resp)

def as_dict(self) -> Dict[str, object]:
result = super().as_dict()
if self.last_active is not None:
result['last_active'] = self._to_rfc3339(self.last_active)
return result


@dataclass
Expand Down

0 comments on commit f82fe98

Please sign in to comment.