Giter Club home page Giter Club logo

Comments (5)

alexeyzimarev avatar alexeyzimarev commented on May 26, 2024

Hmm, have you got a specific case when it fails? The normal sequence is GetLastChecpoint (unconditionally), then StoreCheckpoint. The _counters[checkpointId] entry is initialised in GetLastCheckpoint, so I assumed it will always work.

from eventuous.

StevenBlair123 avatar StevenBlair123 commented on May 26, 2024

@alexeyzimarev - I copied your Checkpoint and built my own (I didn't want to use Mongo)

readonly ConcurrentDictionary<string, int> _counters = new();

And the first occurance of this being used, as you said is GetLastCheckpoint:

_counters[checkpointId] = 0;

I couldn't see any place where the key was initialised, i.e.:

_counters.Add(checkpointId,0);

As soon as I ran my code, I got an exception when GetLastCheckpoint attempted to update the counter which did not exist.

from eventuous.

StevenBlair123 avatar StevenBlair123 commented on May 26, 2024

@alexeyzimarev - clearly you are not seeing the same issue, so could it be a version problem? But a later version of this ConcurrentDictionary creates a new entry in the Dictionary rather than throw an Exception?

from eventuous.

alexeyzimarev avatar alexeyzimarev commented on May 26, 2024

_counters[checkpointId] = 0; is equivalent to Add if the dictionary entry doesn't exist. That's how dictionaries always worked. I am not sure what the issue is in your case. I've never seen it fail.

from eventuous.

StevenBlair123 avatar StevenBlair123 commented on May 26, 2024

@alexeyzimarev - yeah, can't argue with that. I have tried replicating the issue and no luck. My checkpoint was slightly different, and I am wondering if I had somehow managed to try and use the key before the GetLastCheckpoint init.
Insider my GetLastCheckpoint, I called another method which loaded my checkpoint from a file.
From there, I must have assumed it was what i thought was a lack of .Add being called.

Every day's a school day...

Thanks for taking the time to look at this.

from eventuous.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.