Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Only handle recent awareness messagess from sessions
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr authored and max-nextcloud committed Apr 17, 2023
commit 807b47fba2adee09d082e4d20b17c29db536f2c6
4 changes: 1 addition & 3 deletions src/components/Editor/SessionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ import { NcPopover, Tooltip } from '@nextcloud/vue'
import AvatarWrapper from './AvatarWrapper.vue'
import { mapActions, mapState } from 'vuex'
import store from '../../mixins/store.js'

const COLLABORATOR_IDLE_TIME = 60
const COLLABORATOR_DISCONNECT_TIME = 90
import { COLLABORATOR_IDLE_TIME, COLLABORATOR_DISCONNECT_TIME } from '../../services/SyncService.js'

export default {
name: 'SessionList',
Expand Down
7 changes: 6 additions & 1 deletion src/services/SyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const IDLE_TIMEOUT = 1440
*/
const AUTOSAVE_INTERVAL = 30000

const COLLABORATOR_IDLE_TIME = 60

const COLLABORATOR_DISCONNECT_TIME = 90

const ERROR_TYPE = {
/**
* Failed to save collaborative document due to external change
Expand Down Expand Up @@ -173,6 +177,7 @@ class SyncService {

_receiveSteps({ steps, document, sessions }) {
const awareness = sessions
.filter(s => s.lastContact > (Math.floor(Date.now() / 1000) - COLLABORATOR_DISCONNECT_TIME))
.filter(s => s.lastAwarenessMessage)
.map(s => {
return { step: s.lastAwarenessMessage, clientId: s.clientId }
Expand Down Expand Up @@ -288,4 +293,4 @@ class SyncService {
}

export default SyncService
export { SyncService, ERROR_TYPE, IDLE_TIMEOUT }
export { SyncService, ERROR_TYPE, IDLE_TIMEOUT, COLLABORATOR_IDLE_TIME, COLLABORATOR_DISCONNECT_TIME }