Set MAX Item Quantity

Dan Kamins's Avatar

Dan Kamins

22 Apr, 2010 07:27 AM

Your current primitive API operations for tracked items are:

  • set-item-quantity
  • add-item-quantity
  • remove-item-quantity

I am proposing a new primitive:

  • set-item-quantity-if-more

This would be just like set-item-quantity except it would only apply if the new value were greater than the current value.

Examples of use:

  • Charge customers at end of month based on number of stocks they're tracking at any one time. Call API any time stock list size changes.
  • Charge customers at end of month based on size of largest survey they published. Call API each time a new survey response comes in.
  • etc.

As it is now, we can make several calls to load item quantity, check it locally, then call again to update.

But having an atomic primitive like this would make client logic simpler, guarantee atomicity / avoid distributed race conditions, and reduce load on your servers.

  1. Support Staff 1 Posted by Marc Guyer on 24 Apr, 2010 11:51 PM

    Marc Guyer's Avatar

    Interesting idea. I see your point, but the lookup has to occur somewhere. For the vast majority of operations, the lookup will have already taken place, whether within the same request or in the same session.

  2. Dean closed this discussion on 16 Jan, 2013 02:56 PM.

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

Keyboard shortcuts

Generic

? 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