Openbravo Issue Tracking System - POS2
View Issue Details
0052248POS2Corepublic2023-04-03 18:182023-04-26 16:23
AugustoMauch 
AugustoMauch 
normalmajorhave not tried
closedfixed 
5
 
23Q1.3 
No
0052248: Reduce the number of times the state is persisted on disk
The state is being persisted way too often, and that might be a cause of some of the performance problems that have an impact on the 'back to the past” state problem.

As part of this issue we will try to reduce the number of times the state is persisted by:

Adding a new property to persisted models if true will trigger a throttled persistence just after the state action takes place

Increasing the length of redux’s default throttle from 100m to a much longer value (i.e. 30s)

This will prevent the state from being persisted on disk every time the user executes any action (log would be generated and TerminalLog is a persisted model state).
-
No tags attached.
blocks defect 0052052 closed AugustoMauch Reduce the number of times the state is persisted on disk 
Issue History
2023-04-26 11:39AugustoMauchTypedefect => backport
2023-04-26 11:39AugustoMauchTarget Version => 23Q1.3
2023-04-26 13:50hgbotNote Added: 0148924
2023-04-26 16:23hgbotNote Added: 0148939
2023-04-26 16:23hgbotResolutionopen => fixed
2023-04-26 16:23hgbotStatusscheduled => closed
2023-04-26 16:23hgbotFixed in Version => RR23Q1.2
2023-04-26 16:23hgbotNote Added: 0148940
2023-04-26 16:23hgbotNote Added: 0148941
2023-04-26 16:23hgbotNote Added: 0148942
2023-04-26 16:23hgbotNote Added: 0148943

Notes
(0148924)
hgbot   
2023-04-26 13:50   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/502 [^]
(0148939)
hgbot   
2023-04-26 16:23   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1061 [^]
(0148940)
hgbot   
2023-04-26 16:23   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core [^]
Changeset: 054d02ae5adc7309f24d4490665cb185a2f5006f
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 26-04-2023 12:29:41
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/054d02ae5adc7309f24d4490665cb185a2f5006f [^]

Fixes ISSUE-52248: Reduce the number of times the state will be persisted

This fix means to reduce the number of times the application state is persisted (in localStorage, as of now).
Previous behaviour:
* state actions that generate entries in the Messages model are persisted immediately
* other state actions that belong to persisted models are persisted withing a 100ms throttle
* a persistence is forced when logging out

New behaviour:
* state actions that generate entries in the Messages model are persisted immediately (same as before)
* other state actions that belong to persisted models: a) If they its triggerPersistence is set, they are persisted within a 200ms throttle a) If they its triggerPersistence is not set, they are persisted within a 60s throttle (or persisted when any other persistence with higher priority is triggered)
* a persistence is forced when logging out (same as before)
* a persistence is forced when the window is about to be closed/refreshed when the user is logged in

---
M src/org/openbravo/mobile/core/login/MobileCoreLoginUtilsServlet.java
M web-test/model/application-state/State.test.js
M web/org.openbravo.mobile.core/app/model/application-state/State.js
M web/org.openbravo.mobile.core/app/model/application-state/StateAPI.js
M web/org.openbravo.mobile.core/app/model/application-state/StatePersistence.js
M web/org.openbravo.mobile.core/app/model/business-object/remote-server/RemoteServer.js
M web/org.openbravo.mobile.core/app/model/business-object/terminal-log/TerminalLog.js
M web/org.openbravo.mobile.core/source/model/ob-terminal-model.js
---
(0148941)
hgbot   
2023-04-26 16:23   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/502 [^]
(0148942)
hgbot   
2023-04-26 16:23   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2 [^]
Changeset: f4f8b7399974069d4ef1f16f4c1889c12682dc00
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 26-04-2023 13:52:38
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/commit/f4f8b7399974069d4ef1f16f4c1889c12682dc00 [^]

Related to ISSUE-52248: Force the state to be flushed on browser close/refresh if user is logged in

This MR makes sure state is flushed before the user closes/refreshes the POS tab while being logged in. A popup will be displayed asking for conformation, and while the user clicks on it the state will be flushed.

Changes summary:
* `web-jspack/org.openbravo.core2/src/authentication/loginInitActions.js`: Registers the beforeUnload listener when logging in
* `web-jspack/org.openbravo.core2/src/model/session/user-actions/Logout.js`: Unregisters the beforeUnload listener when logging out
* `web-jspack/org.openbravo.core2/src/model/session/__test__/Logout.test.js`: Adapts test

---
M web-jspack/org.openbravo.core2/src/authentication/loginInitActions.js
M web-jspack/org.openbravo.core2/src/model/session/__test__/Logout.test.js
M web-jspack/org.openbravo.core2/src/model/session/user-actions/Logout.js
---
(0148943)
hgbot   
2023-04-26 16:23   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1061 [^]