Yes, so you will need some rework. This is normal. As Marcus says, if you can share a bit more info, we may be able to help steer you a bit more explicitly.
When I login, this works. After I restart the node, all function node functions are not communicating
Eg: I set expire timeout; if node-red not restarted, it worked, if restart didn't work, even i tried contextstorage data, it also not commutincate after restart
Do you mean, its stopped clearing down sessions (for those that were already in situ), if so?
See my previous response below.
The state of a setTimeout cannot be "restored" - its only valid for the current instance of the Javascript VM - this is Javascript, not Node RED.
If you mean it no longer works at all (like, not even creating sessions)
then that is something else - and we need the export of the flow, before we can help further
"Although I stored the expire time in context storage, the data did not resume after restarting."
"I wrote the getExpireTime code in a function node. When the /api/login endpoint is called, does only the function node code work, or are there other options?"
Add a debug node to check if the api/login node is sending a message. If it is, then add debug code to the function node (you can use node.warn() to output to the debug pane) and work out what is going wrong.
That http node only send the message when i call the post endpoint /api/login; if i restart the node-red, the function node code is not resumed
If there is any other way to alwas work the code?
Any other method of doing exactly what?
If you just want to trigger your function when node red restarts then you can use an inject node set to send on startup.
The op is creating a timeout (setTimeout) for every login - to remove the session out of the DB, but once a restart of Node RED has occurred - the timeout state is lost.
This has been explained to the op.
The op was advised to maybe use the inject node to fire at start up, to purge sessions out of the DB.