Skip to content

Load Actor pricing and charged events from env vars #481

@metalwarrior665

Description

@metalwarrior665

Feature

There are now two new env vars: APIFY_CHARGED_ACTOR_EVENT_COUNTS and APIFY_ACTOR_PRICING_INFO plus there is still the existing ACTOR_MAX_TOTAL_CHARGE_USD. These can be used to replace the pricing data currently fetched from GET Run endpoint. The types are the same as in the API just with description stripped out.

The env vars are updated after the resurrect, so the behavior is consistent with refetching the GET Run endpoint now.

More details in Slack thread

Motivation

  1. Lower start latency by skipping the HTTP call
  2. More resistant to API rate limits. For some reason the charging manager init was vulnerable to crash the Actor if the per-account API rate limit was reached.
  3. This can make it easier to later implement local testing. The ACTOR_MAX_TOTAL_CHARGE_USD can be used locally and we could add a CLI helper to inject pricing env vars from local JSON files.

Ideal solution or implementation, and any additional constraints

Don't think there is any complication unless the platform somehow messes up the stringification :)

Alternative solutions or implementations

No response

Other context

No response

Metadata

Metadata

Assignees

Labels

t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions