class Memo::ArcanaListener

Overview

Serves ArcanaService's API on an Arcana::Client.

Requests run concurrently, up to max_concurrency at a time. The client calls on_message from its WebSocket read loop, so handling a request there would hold up every other request, and the replies that memo's own bus calls (the bus/* embedding formats) are waiting for.

Up to max_waiting more requests wait for a turn. Beyond that, memo answers "busy" at once instead of queueing without limit; the read loop can't simply block for backpressure, since memo's own bus calls need it.

Included Modules

Defined in:

arcana/listener.cr

Constant Summary

ADDRESS = "memo:rag"

Constructors

Instance Method Summary

Instance methods inherited from module Memo::BusLog

log(msg : String) log, redact_db_url(url : String) : String redact_db_url, sensitive?(key : String) : Bool sensitive?, summarize(data : JSON::Any) : String summarize, truncate(s : String, max : Int32 = 50) : String truncate

Class methods inherited from module Memo::BusLog

output : IO output, output=(output : IO) output=

Constructor Detail

def self.new(client : Arcana::Client, namespaces : Namespaces, max_concurrency : Int32 = 32, max_waiting : Int32 = max_concurrency * 8) #

[View source]

Instance Method Detail

def handle(envelope : Arcana::Envelope) : Nil #

Answer one request envelope.


[View source]
def listen : Nil #

Answer requests arriving on the client


[View source]
def save_periodically(interval : Time::Span) : Nil #

Every interval, save the indexes of open namespaces that are due. Memo saves on its own after writes; this catches changes that have gone unsaved too long without further writes.


[View source]