Limen.Tarpit (limen v0.2.1)

Copy Markdown View Source

Holds tarpitted requests before denying them.

Delaying a response costs the BEAM very little (the request process sleeps) and costs a scraper a connection for the whole delay. It still holds a connection on your side, so each instance holds at most :max_concurrent requests at once, counted with :atomics; beyond that, requests are denied immediately. Delays are capped at :max_delay milliseconds. Both are options of the :tarpit configuration, see Limen.Config.

Summary

Functions

Number of requests an instance currently holds.

Sleeps for delay milliseconds, capped, unless too many requests are already held. Returns the time actually held.

Functions

held(instance)

@spec held(atom() | Limen.Instance.t()) :: non_neg_integer()

Number of requests an instance currently holds.

hold(instance, delay)

Sleeps for delay milliseconds, capped, unless too many requests are already held. Returns the time actually held.