Skip to content

Immediate allocation syncing between agent and service #123

Open
@Jannis

Description

@Jannis

This is a follow-up to the conversation in #122.

Current behavior

Right now, what happens is that the indexer-agent creates an allocation on-chain. Then, independently, the gateway and indexer-service detect it by querying the network subgraph or contracts. And because gateway and indexer-service don't detect them at the same time, it can happen that the gateway sees an allocation before the indexer-service does, and sends payments through a state channel created for this allocation before the indexer-service has created an attestation signer for the allocation.

Potential improvements

  • Add an internal API in indexer-service that allocations are pushed to by the agent, as soon as they are created. This drastically reduces the chances of the gateway detecting allocations earlier than the indexer-service. This wouldn't be hard to do but requires agent and service to have a direct connection. Alternatively, push the allocations through a shared db, which we already have.

  • Persist allocations in the shared indexer-agent/-service db so that they are not only available to the indexer-service immediately but are also available again immediately after a restart.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

🗃️ Inbox

Relationships

None yet

Development

No branches or pull requests

Issue actions