Openbravo Issue Tracking System - Retail Modules
View Issue Details
0046962Retail ModulesWeb POSpublic2021-06-01 18:422021-06-02 16:47
gorka_gil 
gorka_gil 
normalmajoralways
closedfixed 
5
 
RR20Q4.5RR20Q4.5 
marvintm
No
0046962: error when updating sources - pos1
Serving in production mode

1. Login pos
2. Update sources and deploy
3. Reload pos
  -> ERROR: check console

Error: Cannot drop database POS_state because request is blocked
    at IDBOpenDBRequest.<anonymous>
-
No tags attached.
blocks defect 0046938 closed gorka_gil error when updating sources - pos1 
Issue History
2021-06-02 13:54gorka_gilTypedefect => backport
2021-06-02 13:54gorka_gilTarget Version => RR20Q4.5
2021-06-02 16:44hgbotResolutionopen => fixed
2021-06-02 16:44hgbotStatusscheduled => resolved
2021-06-02 16:44hgbotFixed in Version => RR20Q4.5
2021-06-02 16:44hgbotNote Added: 0128957
2021-06-02 16:47marvintmReview Assigned To => marvintm
2021-06-02 16:47marvintmStatusresolved => closed

Notes
(0128957)
hgbot   
2021-06-02 16:44   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core [^]
Changeset: a291e0773d56daae7cdefe0819e1ae3dd9d21144
Author: Gorka Gil <gorka.gil@openbravo.com>
Date: 2021-06-02T16:43:50+02:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/a291e0773d56daae7cdefe0819e1ae3dd9d21144 [^]

Fixes ISSUE-46962: delete the state on sources update in a better way - pos1

Make use of the api to reset the state

It is the more secure way to delete the state, removing a property of localstorage,
after the reload, the ram is deleted so the state of the ram is lost.
Then it will try to reload the state from disk, but before do that, will check if the
localstorage property exists and if not, will delete the disk state db before try to
load it.

In this way we don't try to delete a running state and there is no race conditions that
can cause problems.

Other discarded options:

a) With indexeddb api, delete the db of the state:
  const persistenceDB = new OB.App.Class.IndexedDBController('state');
  persistenceDB.deleteDatabase().finally(() => {
    window.location.reload();
  });
  - Problem: it deletes an db is use, gives an error that can not be deleted,
  but in any case looks like working, but doesn't look to have the error,
  also doesn't give security that will work always. Also doesn't ensure that
  after delete and before the reload the db is saved again

---
M web/org.openbravo.mobile.core/source/offline/ob-fetch-manifest.js
---