Free trial
Colour

Request limits and file storage

Know the time limit on a request, the size limits on a request and on photos, the storage allowance for each business, and how to read a stored file.

For
AdministratorOwnerDispatcherDriver
Hosting
Office serverYour own hostingHosted plan
Devices
Server
Business
All businesses

Checked against Pop Street Dispatch 0.1.0

The server caps how long a request can run, how large a request can be and how much file space each business can use. You will be able to read each limit, change the two that you control and recover when one stops a request.

Before you start #

  • Changing a limit needs access to the server's environment. See "Hosting the office server".
  • Request rates have their own article, "API rate limits".

The limits #

LimitValueSetting
Time for one request120 secondsPSD_REQUEST_TIMEOUT_SECS
File storage for each business20480 MBPSD_TENANT_STORAGE_QUOTA_MB (0 for no limit)
One photo10 MBfixed
One upload request60 MBfixed
One signatureabout 300 KBfixed
One JSON request16 MBfixed

Steps when a request stops #

  1. A request that runs past the time limit answers request_timeout (408) and the server stops it. Send it again. A client that queues its work, such as the driver app, tries again by itself.
  2. A photo or signature that would take the business past its storage allowance answers storage_quota_exceeded (403) with the message "This business has used all its file storage". Retrying changes nothing, so the driver app shows the message and keeps the item in the Outbox.
  3. Free space, or raise the allowance: set PSD_TENANT_STORAGE_QUOTA_MB to a whole number of megabytes and restart the server.
  4. A photo over 10 MB, or one in any format besides JPEG, PNG and WebP, is refused with upload_failed (422). The other photos in the same request are still saved.
  5. An upload request over 60 MB answers 413. Send fewer photos at a time.

Reading a stored file #

GET /files/:id returns the bytes of a photo, signature or document, with its own content type. JPEG, PNG, WebP and PDF open in the browser, and other types download. Send the sign-in token in the header and show the result from a blob address.

Who can read a file follows the record that owns it. Tow calls and the yard follow the tow roles, repair orders and inspections follow the shop roles, and an asset, document or expense is open to both. A driver reads only what they uploaded. A role without access gets 403, and a missing file gets 404.

Technical details
  • The allowance counts the bytes of all stored files in the business. The check runs before a write, so a write that would pass the allowance is refused whole.
  • Files live in files/<business>/ inside the data folder, under random names. The route serves a stored name only when it is a plain file name.
  • nosniff stays on for every file answer.
  • The value of PSD_REQUEST_TIMEOUT_SECS is a whole number of seconds above zero, and a bad value stops the server at start.

If something goes wrong #

  • 408 on a large report: ask for a shorter date range.
  • 403 storage_quota_exceeded for every driver: raise the allowance or clear old files.
  • 413 on photos: send fewer photos at a time.
  • 403 on GET /files/:id: your role cannot open files of that kind.