mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-01-05 02:29:37 +00:00
POC: Add LastSeenManager to batch user activity updates
This commit is contained in:
parent
d21fe49ce2
commit
0749a55deb
3 changed files with 144 additions and 4 deletions
|
|
@ -269,9 +269,11 @@ class SocketAuthority {
|
|||
|
||||
this.adminEmitter('user_online', client.user.toJSONForPublic(this.Server.playbackSessionManager.sessions))
|
||||
|
||||
// Update user lastSeen without firing sequelize bulk update hooks
|
||||
user.lastSeen = Date.now()
|
||||
await user.save({ hooks: false })
|
||||
if (this.Server.lastSeenManager) {
|
||||
this.Server.lastSeenManager.addActiveUser(user.id)
|
||||
// To ensure actual lastSeen behaviour does not change, we just flush when connecting. This should not add much overhead as this is only for the authenticated socket.
|
||||
this.Server.lastSeenManager.flushActiveUsers()
|
||||
}
|
||||
|
||||
const initialPayload = {
|
||||
userId: client.user.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue