1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Minimize inactive timer resets (#8531)

The inactive timer was being reset upon any change to the preferences
store. The intent was only to update the timer when the auto-lock
timeout had changed, so the subscription was updated to only update in
those cases.

There are no indications that this had any effect upon the user. It
looks like the preferences store never updates while the extension is
unattended, so in practice this may have been harmless. It was still
pointless however. This also protects against the possibility of the
preferences store being updated while unattended at some point in the
future.
This commit is contained in:
Mark Stacey 2020-05-05 20:30:50 -03:00 committed by GitHub
parent 18b00ed835
commit 3d0ffc50f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,8 +32,11 @@ export default class AppStateController extends EventEmitter {
this._showUnlockRequest = showUnlockRequest
preferencesStore.subscribe((state) => {
this._setInactiveTimeout(state.preferences.autoLockTimeLimit)
preferencesStore.subscribe(({ preferences }) => {
const currentState = this.store.getState()
if (currentState.timeoutMinutes !== preferences.autoLockTimeLimit) {
this._setInactiveTimeout(preferences.autoLockTimeLimit)
}
})
this._setInactiveTimeout(preferences.autoLockTimeLimit)