Syncing updates

Mike Bray (Quote Loader Author)'s Avatar

Mike Bray (Quote Loader Author)

24 Dec, 2020 11:24 AM

A user has posted an issue ( where the data on a currency snapshot record is not updated immediately. I have had a look at it and a snapshot record is created but the info parameters are not updated. If I restart MD, this data appears.

In Quote Loader after I create/update a snapshot record I call syncItem() on the snapshot and then syncItem() on the currency. Is there anything else I should do?

  1. 1 Posted by Stuart Beesley ... on 24 Dec, 2020 01:26 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    Hi Mike, I'm trying to debug this right now for the user..... It's very odd!

    The first time I looked, the snapshot parameters were there, then when the error triggers they are not. However, they must be there as otherwise snapshot.getRate() etc would not work and the currency screen still shows the info. I am baffled. I've reproduced this on 2017 thru 2021. Even with a new dataset where I enter 1 snapshot manually I get the error now.

    The only thing I can find is this code and I'm wondering if it's triggering and hiding the parameters..?

    NOTE a restart of MD does not always make it appear.. I currently can't get the data to appear, but I know from the user that if he restarts 12+ times, then it appears....??

    The only thing I can see is this in CurrencySnapshot.class
      public synchronized void itemWasUpdated() { ="dt", 0);
        this.baseRate ="urt", 1.0D);
        this.dvolume ="vol", 0L);
        this.baseHigh ="hi", 0.0D);
        this.baseLow ="lo", 0.0D);
        this.relativeRate ="relrt", 0.0D);
        this.relativeLow ="rlo", 0.0D);
        this.relativeHigh ="rhi", 0.0D);
        if (Double.isNaN(this.relativeRate))

    .. and these are the ones that are missing??!!

  2. 2 Posted by Stuart Beesley ... on 24 Dec, 2020 03:42 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    Hi Mike, further proof... Attached are when I get the error to trigger and also when it doesn't. (by restarting MD). Even when QL not loaded....

    The attached are the same dataset, after different restarts.

    You can run the attached script to see if/when you get the error (edit line 50 first). It will tell you when error has triggered. I keep restarting MD and running this until no error..

    VERY ODD?!?!?

  3. 3 Posted by Stuart Beesley ... on 27 Dec, 2020 05:53 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    Hi Mike, a further update.... you are right that when QL runs, it triggers this 'error' condition until restart... BUT so does using the actual security history screen (sometimes)... also a snapshot.deleteItem() doesn't take effect until restart, so there is something screwy going on.... BUT sometimes, every record (8300 snapshots in my dataset) goes into this error condition with keys missing, until several reboots...../?!!

    I've also noticed I have some orphan snapshots. They exist in book.getSyncer().getSyncedDocument().allItems() as "obj_type" == "csnap", but they do not exist in the curr.getSnapshots(). The odd thing is I cannot see why - they seem deattached.... I'm wondering if sometimes QL runs and then I manually update snapshots and we get a clash.... So I still think the MD underlying code has a bug somewhere..?

  4. 4 Posted by Stuart Beesley ... on 29 Dec, 2020 09:54 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    Sean (the developer) has responded ‘the csnap thing is because I purge the map that backs the currency snapshots in an effort to save a bit of RAM, because there can be such huge numbers of snapshots that their maps really add up. I’ll put the data/map back when the export json function is called in the next build.’

  5. Melissa closed this discussion on 28 Jan, 2021 02:53 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac