Skip to content

Commit

Permalink
Flush activity store state immediately on touch
Browse files Browse the repository at this point in the history
  • Loading branch information
chromakode committed Jan 12, 2016
1 parent 2a159b4 commit 04c85b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/lib/stores/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports.store = Reflux.createStore({
lastVisit: {},
}
this._active = {}
this._flushActivityThrottled = _.throttle(this._flushActivity, this.flushTime, {leading: false})
this._flushActivityThrottled = _.throttle(this._flushActivity, this.flushTime)
this._setIdleDebounced = _.debounce(this._setInactive, this.idleTime)
},

Expand Down
4 changes: 4 additions & 0 deletions client/test/activity-store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ describe('activity store', () => {
})

it('should be written within ' + activity.store.flushTime + 'ms of activity', () => {
const firstTouchTime = Date.now()
activity.store.touch(roomName)
sinon.assert.calledOnce(storage.setRoom)
sinon.assert.calledWithExactly(storage.setRoom, roomName, 'lastActive', firstTouchTime)
storage.setRoom.reset()
clock.tick(1000)
const lastTouchTime = Date.now()
activity.store.touch(roomName)
Expand Down

0 comments on commit 04c85b5

Please sign in to comment.