[bisq-network/bisq] [WIP] Workaround API editoffer event rcv order problem in peer UI (#5627)
Stan
notifications at github.com
Sun Jul 18 23:57:46 CEST 2021
When the API is used to edit an offer, the daemon's `P2PDataStorage` will send `onRemoved(offer)`and `onAdded(offer)` events 1-3 ms apart, and those events may arrive at a peer's UI in the wrong order: `onAdded`, then `onRemoved`. When the event receive order is backwards, the edited offer disappears from the UI's OfferBook view.
Reloading the `OfferBook#offerBookListItems` works around the problem. Reloading 100 offers usually takes ~ 1-2 ms.
_I said "less than 1ms" in the commit message, but I am still testing the load time while more offers are added._
The proper solution is probably in or near 2+ other classes:
- `P2PDataStorage`, where these events are fired in the correct order, but down to 1ms apart.
- `OfferBookService`, where a peer UI's `HashMapChangedListener` methods 'onRemoved' and 'onAdded' are sometimes called in backwards order, causing API edited offers to disappear.
Trying to insert a delay between remove an offer for edit then republishing the offer does not work. The events can still arrive in the wrong order.
I might need some help from @chimp1984 to solve this.
This is the 6th in a series of PRs, beginning with https://github.com/bisq-network/bisq/pull/5570.
https://github.com/bisq-network/bisq/pull/5577 should be reviewed and merged before this one.
Note: All commits prior to 1d21cb9c10882238c29153de049c33cf17b64d9a (near the end of this page's commit list) have been reviewed.
You can view, comment on, or merge this pull request online at:
https://github.com/bisq-network/bisq/pull/5627
-- Commit Summary --
* Refactor EditOfferDataModel for new editoffer api method
* Fix comment
* Add OfferInfo field isActivated, rpc EditOffer to proto
* Add server/core editOffer, adjust getMyOffer(s) impls
* Refactor GrpcClient: request builders moved bisq.cli.request pkg
* Add new EditOfferOptionParser and test
* Add editoffer method help
* Add editoffer to CLI
* Add editoffer api tests & minor apitest refactoring
* Remove chase quickpay acct test
* Remove unused import
* Fix problems found in codacy check
* Fix codacy issue
* Fix log arg spec bug
* Add bool isMyOffer to OfferInfo proto
* Fix editoffer validation bugs, tidy up CoreOffersService
* Show enable/trigger-price cols for 'getmyoffer'
* Improve 'editoffer' opt parsing, fix test pkg name
* Add editoffer test case, suppress annoying warnings
* Remove unused field
* Throw exception is edit altcoin offer is attempted
* Avoid duplicate test run
* Make codacy just a bit happier
* Force codacy check after codacy config change
* Include isMyOffer flag in API's trade/offer proto wrappers
* Pass isMyOffer flag to trade/offer proto wrappers from core services
* Add altcoin (bsq) offer editing validation check
* Optionally show ENABLED column in CLI's getoffer(bsq) output
* Add BSQ offer editing tests to EditOfferTest
* Merge branch 'master' into 02-refactor-for-api-editoffer-method
* Merge branch '02-refactor-for-api-editoffer-method' into 03-api-editoffer-method
* Merge branch '03-api-editoffer-method' into 04-edit-bsq-offer
* Force rebuild after github action ECONNRESET
* Document api 'editoffer' usage
* Fix header
* Delete tmp main() method
* Rename and move private function
* Do not duplicate Price.parse on CLI side for only one use case
* Remove old TODO because relevant refactoring was approved
* Fix typo 'enabled' -> 'enable'
* Always use Locale.US in CLI DecimalFormats
* Merge branch 'master' into 06-add-remove-evt-order-workaround
* Add missing 0 trigger-price param
* Workaround API editoffer event rcv order problem in peer UI
-- File Changes --
M apitest/docs/api-beta-test-guide.md (114)
M apitest/src/test/java/bisq/apitest/method/offer/AbstractOfferTest.java (58)
M apitest/src/test/java/bisq/apitest/method/offer/CancelOfferTest.java (3)
M apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingMarketPriceMarginTest.java (57)
A apitest/src/test/java/bisq/apitest/method/offer/EditOfferTest.java (644)
M apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java (3)
M apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferWithNationalBankAcctTest.java (3)
M apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java (3)
A apitest/src/test/java/bisq/apitest/scenario/LongRunningOfferDeactivationTest.java (167)
M apitest/src/test/java/bisq/apitest/scenario/OfferTest.java (30)
M apitest/src/test/java/bisq/apitest/scenario/bot/BotClient.java (11)
M apitest/src/test/java/bisq/apitest/scenario/bot/RandomOffer.java (9)
M cli/src/main/java/bisq/cli/CliMain.java (42)
M cli/src/main/java/bisq/cli/ColumnHeaderConstants.java (3)
M cli/src/main/java/bisq/cli/CurrencyFormat.java (75)
M cli/src/main/java/bisq/cli/GrpcClient.java (377)
M cli/src/main/java/bisq/cli/Method.java (1)
M cli/src/main/java/bisq/cli/TableFormat.java (185)
M cli/src/main/java/bisq/cli/opts/AbstractMethodOptionParser.java (4)
A cli/src/main/java/bisq/cli/opts/EditOfferOptionParser.java (281)
M cli/src/main/java/bisq/cli/opts/OptLabel.java (2)
A cli/src/main/java/bisq/cli/request/OffersServiceRequest.java (319)
A cli/src/main/java/bisq/cli/request/PaymentAccountsServiceRequest.java (85)
A cli/src/main/java/bisq/cli/request/TradesServiceRequest.java (94)
A cli/src/main/java/bisq/cli/request/WalletsServiceRequest.java (192)
A cli/src/test/java/bisq/cli/opts/EditOfferOptionParserTest.java (346)
R cli/src/test/java/bisq/cli/opts/OptionParsersTest.java (11)
M core/src/main/java/bisq/core/api/CoreApi.java (47)
M core/src/main/java/bisq/core/api/CoreOffersService.java (193)
A core/src/main/java/bisq/core/api/EditOfferValidator.java (141)
M core/src/main/java/bisq/core/api/model/OfferInfo.java (45)
M core/src/main/java/bisq/core/api/model/TradeInfo.java (10)
A core/src/main/java/bisq/core/offer/MutableOfferPayloadFields.java (89)
M core/src/main/java/bisq/core/offer/OfferUtil.java (47)
A core/src/main/resources/help/editoffer-help.txt (95)
M daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java (31)
M daemon/src/main/java/bisq/daemon/grpc/GrpcTradesService.java (6)
M desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBook.java (11)
M desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java (49)
M proto/src/main/proto/grpc.proto (33)
-- Patch Links --
https://github.com/bisq-network/bisq/pull/5627.patch
https://github.com/bisq-network/bisq/pull/5627.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5627
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210718/16dc3cdd/attachment-0001.htm>
More information about the bisq-github
mailing list