Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums
  1. Home
  2. Cloud Code
  3. Cloud code retries, error handling question

Cloud code retries, error handling question

Scheduled Pinned Locked Moved Unsolved Cloud Code
cloud codeerror
2 Posts 2 Posters 1.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kuabs
    wrote on last edited by
    #1

    Scenario:
    Lets say a user needs to consume 1 item to upgrade another. Its a perfect task for cloud code to prevent exploits. Lets say both items are each a user entity or custom entity (doesn't matter which).

    In the cloud script, if we get item 1 (material item) and delete it, and then get item 2 (item to upgrade) and attempt to enhance it, but the first call (delete) works and the second call (upgrade) fails (maybe network failure or something), wouldn't this result in a scenario where the user lost their item without getting the upgrade?

    Perhaps the only solution to this is to make the users items one large entity, broken up into multiple items, so that the cloud script can either fail and no item gets consumed, or succeed and edit the larger "items" which does both delete the item and upgrade the other in the same call?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Panagiotis Milios
      wrote on last edited by Panagiotis Milios
      #2

      A good way to handle failure besides retrying in code, is to schedule another script to run 1 minute later that will basically repeat the same action.

      1 Reply Last reply
      1

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Solved
      • Unsolved
      • Users