GithubHelp home page GithubHelp logo

Comments (2)

breath103 avatar breath103 commented on May 30, 2024

https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
The individual PutItem and DeleteItem operations specified in BatchWriteItem are atomic; however BatchWriteItem as a whole is not. If any requested operations fail because the table's provisioned throughput is exceeded or an internal processing failure occurs, the failed operations are returned in the UnprocessedItems response parameter. You can investigate and optionally resend the requests. Typically, you would call BatchWriteItem in a loop. Each iteration would check for unprocessed items and submit a new BatchWriteItem request with those unprocessed items until all items have been processed.
So this is legit, thanks for pointing out :) . However i'm slightly concerned about the interface here, since there are many options we can customize. (How many retries / Delay between retry / What happens when insert keeps fails)

For

  • How many retries (even "infinite" until unprocessed items become empty)
  • Delay between retries,
    we can decide some default value on library level and let user to customize it if they want i guess? which would be sufficient for most of common use cases anyway. So that keep code not be rewritten because of this change.
    (if we add "maximumRetry" as required parameter on batchDelete / batchPut, that would require existing codes to revised)

But

  • When the maximum number of retries all fails, what happens?
    is a bit more complicated problem. should we just raise an error? or... let me know if you have an opinion on this. I'd do this personally if the specification become more clear! this is something we've been clearly missing

from dynamo-types.

ktwbc avatar ktwbc commented on May 30, 2024

Sorry for the delay in responding. Since the error message only comes about through throttling and eventually throttling will let it through, infinite is probably not a bad option. (I'm using this in a lambda function which would time out on its own in 5 minutes or less, I'm not sure what a standard node function would do if a runaway process can be killed by the node engine with express. But the throttling by definition basically says "eventually this will succeed")

For delay strategy, probably an exponential backoff strategy would be best, though maybe a setting between exponential and linear would be better.

from dynamo-types.

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.