Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0048847
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Web POSmajorhave not tried2022-03-21 10:402022-06-22 16:57
ReporteraferrazView Statuspublic 
Assigned ToAugustoMauch 
PrioritynormalResolutionfixedFixed in VersionRR22Q3
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0048847: JIRA 2948: SynchronizationBuffer loads messages in a random order

DescriptionWhen adding more than one message into Messages state model inside the same state action, sometimes the import entry for the second added message is created before the import entry of the first added message.

The problem seems to be that the "time" property of the messages is being considered to sort them, and the time of the OBPOS_Order message is the same one as the time of the messages generated on the backend (see attached screenshot), and as a consequence their order will not be deterministic.
Steps To ReproduceAdd following postHook to completeTicket action:
OB.App.StateAPI.Global.completeTicket.addPostHook(globalState => ({
  ...globalState,
  Messages: [
    ...globalState.Messages,
    OB.App.State.Messages.Utils.createNewMessage(
      'MyModel',
      'MyModelEndpoint',
      {}
    )
  ]
}));

Add log into findAll function in MessageModelController.js and check sometimes OBPOS_Order message is retrieved first (the one added inside the state action) and other times MyModel message is retrieved first (the one added inside the post hook).
The same happens in ImportEntryBuilder.createImportEntry.
TagsNo tags attached.
Attached Filespng file icon MessageOrder.png [^] (182,485 bytes) 2022-06-04 11:03

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0048865 closedRetail POS2 Proof of Payment are not always created through Split Payment functionality 

-  Notes
(0138036)
hgbot (developer)
2022-06-04 12:19

Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/376 [^]
(0138039)
hgbot (developer)
2022-06-04 20:47

Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/377 [^]
(0138247)
hgbot (developer)
2022-06-10 11:13

Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/376 [^]
(0138248)
hgbot (developer)
2022-06-10 11:14

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core [^]
Changeset: 1b9d5335c16d4711f4c3305639a9288b2864c233
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 10-06-2022 11:13:18
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/1b9d5335c16d4711f4c3305639a9288b2864c233 [^]

Fixes ISSUE-48847: Guarantees proper message processing order

The problem was that if some messages for the same backend are created within the same millisecond, they will have the same
value in their time property. If two messages have the same time, then when the MessageModelController retrieves them from
the database [1], there will be no guarantee that they are returned in the same order they were added to the messages queue.

To fix it, now the MessageModelController will add a sequence number (its position in the incoming message list) to each message
before storing it in the database. It then uses both the time property and the new sequence number to read the ordered message
list from the database.

Also when setting the time of the message, new Date().getTime() has been replaced with Date.now() because it has better performance.

[1] https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/blob/6e7893c6474f5069a30ddc539182d2b8c870c520/web/org.openbravo.mobile.core/app/model/synchronization-buffer/MessageModelController.js\#L46 [^]

---
M web/org.openbravo.mobile.core/app/model/business-object/messages/MessagesUtils.js
M web/org.openbravo.mobile.core/app/model/synchronization-buffer/MessageModelController.js
---
(0138297)
hgbot (developer)
2022-06-13 10:55

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: 75f57703155bc981939b14c19568adfda78e4bba
Author: Javier Armendáriz <javier.armendariz@openbravo.com>
Date: 13-06-2022 10:55:22
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/75f57703155bc981939b14c19568adfda78e4bba [^]

Related to ISSUE-48847: Fixes tests that mocks Date object during Message creation

---
M web-test/model/business-object/cashup/Cashup-completeCashupAndCreateNew.test.js
M web-test/model/business-object/cashup/Cashup-initCashup-StateAction-fromScratch.test.js
---
(0138317)
hgbot (developer)
2022-06-13 17:01

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core [^]
Changeset: 7cab8bc36de7d196efb745334ddd258b58791598
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 13-06-2022 17:01:19
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/7cab8bc36de7d196efb745334ddd258b58791598 [^]

Related to ISSUE-48847: MessageModelController.put may receive an array or an object

---
M web/org.openbravo.mobile.core/app/model/synchronization-buffer/MessageModelController.js
---
(0138639)
hgbot (developer)
2022-06-22 16:57

Merge request closed: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/377 [^]

- Issue History
Date Modified Username Field Change
2022-03-21 10:40 aferraz New Issue
2022-03-21 10:40 aferraz Assigned To => Triage Platform Base
2022-03-21 10:40 aferraz Triggers an Emergency Pack => No
2022-03-21 10:48 aferraz Description Updated View Revisions
2022-03-21 10:49 aferraz Summary SynchronizationBuffer synchronizes messages in a random order => SynchronizationBuffer loads messages in a random order
2022-03-21 10:54 aferraz Steps to Reproduce Updated View Revisions
2022-03-23 08:05 andre_montenegro Relationship added related to 0048865
2022-05-26 13:23 guilleaer Summary SynchronizationBuffer loads messages in a random order => JIRA 2948: SynchronizationBuffer loads messages in a random order
2022-05-26 13:23 guilleaer Assigned To Triage Platform Base => jarmendariz
2022-05-26 13:23 guilleaer Status new => acknowledged
2022-06-04 11:03 AugustoMauch File Added: MessageOrder.png
2022-06-04 11:05 AugustoMauch Description Updated View Revisions
2022-06-04 12:19 hgbot Note Added: 0138036
2022-06-04 12:21 AugustoMauch Assigned To jarmendariz => AugustoMauch
2022-06-04 12:21 AugustoMauch Status acknowledged => scheduled
2022-06-04 20:47 hgbot Note Added: 0138039
2022-06-10 11:13 hgbot Note Added: 0138247
2022-06-10 11:14 hgbot Resolution open => fixed
2022-06-10 11:14 hgbot Status scheduled => closed
2022-06-10 11:14 hgbot Fixed in Version => RR22Q3
2022-06-10 11:14 hgbot Note Added: 0138248
2022-06-13 10:55 hgbot Note Added: 0138297
2022-06-13 17:01 hgbot Note Added: 0138317
2022-06-22 16:57 hgbot Note Added: 0138639


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker