Skip to content

Commit b2f477f

Browse files
authored
Immediately store last used node id (#483)
1 parent 64e9da9 commit b2f477f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

matter_server/server/device_controller.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,9 @@ def resubscription_succeeded(
843843

844844
def _get_next_node_id(self) -> int:
845845
"""Return next node_id."""
846-
return cast(int, self.server.storage.get(DATA_KEY_LAST_NODE_ID, 0)) + 1
846+
next_node_id = cast(int, self.server.storage.get(DATA_KEY_LAST_NODE_ID, 0)) + 1
847+
self.server.storage.set(DATA_KEY_LAST_NODE_ID, next_node_id, force=True)
848+
return next_node_id
847849

848850
async def _call_sdk(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> _T:
849851
"""Call function on the SDK in executor and return result."""

0 commit comments

Comments
 (0)