Software / code / prosody
Comparison
plugins/mod_smacks.lua @ 12135:fa804c2db747
mod_smacks: Record timestamp with persisted counters
For future cleanup routine when people inevitably complain about this
data being stored there forever
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 31 Dec 2021 00:18:13 +0100 |
| parent | 12125:649268c9f603 |
| child | 12136:6366240d2edb |
comparison
equal
deleted
inserted
replaced
| 12134:912614c4bf3e | 12135:fa804c2db747 |
|---|---|
| 465 return | 465 return |
| 466 end | 466 end |
| 467 | 467 |
| 468 session.log("debug", "Destroying session for hibernating too long"); | 468 session.log("debug", "Destroying session for hibernating too long"); |
| 469 session_registry[jid.join(session.username, session.host, session.resumption_token)] = nil; | 469 session_registry[jid.join(session.username, session.host, session.resumption_token)] = nil; |
| 470 old_session_registry:set(session.username, session.resumption_token, { h = session.handled_stanza_count }); | 470 old_session_registry:set(session.username, session.resumption_token, |
| 471 { h = session.handled_stanza_count; t = os.time() }); | |
| 471 session.resumption_token = nil; | 472 session.resumption_token = nil; |
| 472 session.resending_unacked = true; -- stop outgoing_stanza_filter from re-queueing anything anymore | 473 session.resending_unacked = true; -- stop outgoing_stanza_filter from re-queueing anything anymore |
| 473 sessionmanager.destroy_session(session, "Hibernating too long"); | 474 sessionmanager.destroy_session(session, "Hibernating too long"); |
| 474 sessions_expired(1); | 475 sessions_expired(1); |
| 475 end); | 476 end); |
| 679 -- counter value, so it can be communicated to the client when it tries to | 680 -- counter value, so it can be communicated to the client when it tries to |
| 680 -- resume the lost session after a restart. | 681 -- resume the lost session after a restart. |
| 681 for _, user in pairs(local_sessions) do | 682 for _, user in pairs(local_sessions) do |
| 682 for _, session in pairs(user.sessions) do | 683 for _, session in pairs(user.sessions) do |
| 683 if session.resumption_token then | 684 if session.resumption_token then |
| 684 if old_session_registry:set(session.username, session.resumption_token, { h = session.handled_stanza_count }) then | 685 if old_session_registry:set(session.username, session.resumption_token, |
| 686 { h = session.handled_stanza_count; t = os.time() }) then | |
| 685 session.resumption_token = nil; | 687 session.resumption_token = nil; |
| 686 | 688 |
| 687 -- Deal with unacked stanzas | 689 -- Deal with unacked stanzas |
| 688 if session.outgoing_stanza_queue then | 690 if session.outgoing_stanza_queue then |
| 689 handle_unacked_stanzas(session); | 691 handle_unacked_stanzas(session); |