diff options
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/ServicesStore.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 9521f8493..6064b9929 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -166,8 +166,8 @@ export default class ServicesStore extends Store { | |||
166 | _serviceMaintenance() { | 166 | _serviceMaintenance() { |
167 | this.all.forEach((service) => { | 167 | this.all.forEach((service) => { |
168 | // Defines which services should be hibernated. | 168 | // Defines which services should be hibernated. |
169 | if (!service.isActive && (Date.now() - service.lastUsed > ms('5m'))) { | 169 | if (!service.isActive && (Date.now() - service.lastUsed > ms(`${this.stores.settings.all.app.hibernationStrategy}s`))) { |
170 | // If service is stale for 5 min, hibernate it. | 170 | // If service is stale, hibernate it. |
171 | this._hibernate({ serviceId: service.id }); | 171 | this._hibernate({ serviceId: service.id }); |
172 | } | 172 | } |
173 | 173 | ||
@@ -820,19 +820,23 @@ export default class ServicesStore extends Store { | |||
820 | 820 | ||
821 | @action _hibernate({ serviceId }) { | 821 | @action _hibernate({ serviceId }) { |
822 | const service = this.one(serviceId); | 822 | const service = this.one(serviceId); |
823 | if (service.isActive || !service.isHibernationEnabled) { | 823 | if (!service.canHibernate) { |
824 | return; | ||
825 | } | ||
826 | if (service.isActive) { | ||
824 | debug('Skipping service hibernation'); | 827 | debug('Skipping service hibernation'); |
825 | return; | 828 | return; |
826 | } | 829 | } |
827 | 830 | ||
828 | debug(`Hibernate ${service.name}`); | 831 | debug(`Hibernate ${service.name}`); |
829 | 832 | ||
830 | service.isHibernating = true; | 833 | service.isHibernationRequested = true; |
831 | } | 834 | } |
832 | 835 | ||
833 | @action _awake({ serviceId }) { | 836 | @action _awake({ serviceId }) { |
837 | debug('Waking up from service hibernation'); | ||
834 | const service = this.one(serviceId); | 838 | const service = this.one(serviceId); |
835 | service.isHibernating = false; | 839 | service.isHibernationRequested = false; |
836 | service.liveFrom = Date.now(); | 840 | service.liveFrom = Date.now(); |
837 | } | 841 | } |
838 | 842 | ||