Shopify.GraphQL.Limiter.Producer (shopify_graphql v1.6.0)

Link to this section Summary

Functions

Returns the number of events queued by a producer.

Begins the process of waiting for a shop's cost bucket to drain.

Returns whether the producer is currently waiting for a shop's cost bucket to drain.

Determines whether a producer is in an idle state.

Synchronously processes a request.

Puts the producer in a restored state and restarts processing requests.

Adds a request to the front of the processing queue.

Starts a Shopify.GraphQL.Limiter.Producer process and links it to the supervision tree.

Stops the producer from fulfilling demand.

Returns the throttle status.

Starts demand fulfillment.

Link to this section Functions

Specs

Returns the number of events queued by a producer.

Link to this function

drain(server, throttle_state)

Specs

Begins the process of waiting for a shop's cost bucket to drain.

A drain will create a timer based on the minimum acceptable cost to unthrottle the producer. Once the timer ends the producer will be put in a restored state that will restart request processing.

Note that this function will not throttle the producer. It is expected that a producer will be in a throttled state before a drain is initiated.

Link to this function

draining?(server)

Specs

draining?(GenStage.stage()) :: boolean()

Returns whether the producer is currently waiting for a shop's cost bucket to drain.

Specs

idle?(GenStage.stage()) :: boolean()

Determines whether a producer is in an idle state.

A producer is considered idle when it's queue length is 0.

Link to this function

name(parent, partition_id)

Specs

Returns the name of a Shopify.GraphQL.Limiter.Producer process.

A producer process's name is a combination of the parent limiter's name and a partition id. e.g. Shopify.GraphQL.Limiter.Producer:<partition_id>.

Link to this function

process(server, operation, config)

Specs

Synchronously processes a request.

Link to this function

restore(server)

Specs

restore(GenStage.stage()) :: :ok

Puts the producer in a restored state and restarts processing requests.

This function is typically called after a drain has completed.

Link to this function

retry(server, operation, config)

Specs

Adds a request to the front of the processing queue.

Link to this function

start_link(opts)

Specs

start_link(Keyword.t()) :: GenServer.on_start()

Starts a Shopify.GraphQL.Limiter.Producer process and links it to the supervision tree.

Link to this function

throttle(server)

Specs

throttle(GenStage.stage()) :: :ok

Stops the producer from fulfilling demand.

Link to this function

throttled?(server)

Specs

throttled?(GenStage.stage()) :: boolean()

Returns the throttle status.

Link to this function

unthrottle(server)

Specs

unthrottle(GenStage.stage()) :: :ok

Starts demand fulfillment.