LogoLogo
  • Getting Started
    • Supplier API (ZAPI)
    • Getting Started
      • Implementing Exponential Back-Off
    • API Specification
    • API Specification Enhancements
    • Glossary of Terms
  • Supporting Nodes
    • Supporting Nodes
      • Single Booking Details
      • Currencies
      • Cart
      • Activity Times
      • Products
      • Business Hours
      • Pickup Locations
      • Dropoff Location
      • Rental Date & Times
      • Allowed Guest Types
      • Waitlist
      • Passenger List
      • Guest or Agent Details
      • User Custom Fields
      • Related Bookings
      • Transaction Details
        • Basic Transaction
        • Credit Card Transaction
        • Voucher/Invoice Transaction
        • Discount Transaction
      • Days of the Week
      • Price Code
      • Multi-Day Package Itinerary
      • Booking - Search Results
      • Mobile Data
  • ZAPI Calls
    • Start Here
      • Ping Test
    • Activity Calls
      • All Activities by Date
      • All Activities by Name
      • Activity & Product Catalog
      • Activity Categories
      • Activity Category by ID
      • Cancelled Activities
      • Create Cancellation
      • Check Inventory
      • Single Activity Details
      • Upcoming Activities
      • Remove Cancellation
      • Rental Equipment Calls
        • Equipment Price Quote
        • Equipment Availability
        • Cart Contents
        • Add to Cart
    • Agent Calls
      • Agent Login
      • Authenticate Agent
      • Get Agent Profile
      • Update Agent Username
      • Update Agent Password
    • Booking
      • Batch Availability
      • Booking Search
        • Search Bookings
        • Search by Booking Number
        • Search by Last Name
        • Search by Mobile Number
      • Cancel Booking
      • Email Itinerary
      • Generate Barcode Image
      • Ticket Data by Booking ID
    • Guest Specific
      • Authenticate Guest
      • Booking Details
      • Get Guest Profile
      • Guest Lookup
      • Update Username
      • Update Password
      • Update Profile
    • Interacting with a Cart
      • Add Activity to Cart
      • Add Package to Cart
      • Add Product to Cart
      • Clear Cart Session
      • Create a Unique Cart
      • Get All Cart Sessions
      • Get Cart Contents
      • Load Booking into Cart
      • Remove Activity
      • Remove Product
      • Remove Cart Session
      • Update Notes to Cart
      • Update Customer Details
      • Transactions
        • Process Payment
        • Process Single Transaction
        • Apply Promo Code
        • Apply Gift Card
    • Manifest
      • Entire Day Manifest
      • Activity Manifest
    • Mobile
      • Check In
      • Generate Z Report
      • User Logout
    • Packages
      • Get Package Categories
      • Get Packages by Category
      • Get Package Details
      • Minimum Dates to Book
      • Package Pricing Details
    • Products
      • Product Inventory
      • Product Categories
      • Product by Category
      • Product by Name
      • Single Product Detail
    • System Info
      • All Companies
      • All Equipment
      • Custom Fields List
      • Employee List
      • Get System Info
      • User List
    • Waitlist
      • Single Activity Waitlist
      • Add Guest
      • Convert to Cart
      • Remove Guest
  • Appendix
    • Activity Type IDs
    • Error Codes
    • Package Type IDs
    • Product Type IDs
    • Payment Method Type IDs
    • User Type IDs
Powered by GitBook
On this page

Was this helpful?

  1. Getting Started
  2. Getting Started

Implementing Exponential Back-Off

Exponential back-off is the process of a client periodically retrying a failed request over an increasing amount of time. It is a standard error handling strategy for network applications.

Besides being “required”, using exponential back-off increases the efficiency of bandwidth usage, reduces the number of requests required to get a successful response and maximizes the throughput of requests in concurrent environments.

The flow of implementing a simple exponential back-off is as follows:

  1. Make a request to the API

  2. Receive the response, check for error that has a retry-able error code (such as 503)

  3. Wait 1s + random_number_milliseconds seconds

  4. Retry request

  5. Receive the response, check for error that has a retry-able error code (such as 503)

  6. Wait 2s + random_number_milliseconds seconds

  7. Retry request

  8. Receive the response, check for error that has a retry-able error code (such as 503)

  9. Wait 4s + random_number_milliseconds seconds

  10. Retry request

  11. Receive the response, check for error that has a retry-able error code (such as 503)

  12. Wait 8s + random_number_milliseconds seconds

  13. Retry request

  14. Receive the response, check for error that has a retry-able error code (such as 503)

  15. Wait 16s + random_number_milliseconds seconds

  16. Retry request

  17. If you still get an error, stop and log the error

Note: random_number_milliseconds MUST be redefined after each “Wait”

In the above flow, random_number_milliseconds is a random number of milliseconds less than or equal to 1000. This is necessary to avoid certain lock errors in some concurrent implementations.

Note: the wait is always (2^n) + random_number_milliseconds, where n is a monotonically increasing integer initially defined as 0. N is incremented by 1 for each iteration (each request)

The algorithm is set to terminate when n == 5. This ceiling is in place to prevent clients from retrying infinitely, and results in a total delay of 32 seconds before a deemed “unrecoverable error.”

PreviousGetting StartedNextAPI Specification

Last updated 3 years ago

Was this helpful?