Skip to content

Store RPC tasks in a TimedMap instead of plain Map #2671

@mariocynicys

Description

@mariocynicys

Tasks registered via the RPC can have their results optionally streamed to the clients without them having to hit ::status method.

Clients may rely on streaming in a way that they never make use of ::status all together (unless maybe when the expected streaming result didn't arrive for so long).

This means that we will ever call self.task_status(task_id, false):
https://github.com/KomodoPlatform/komodo-defi-framework/blob/a295579b8b29815f5aa2d8a999c992bbbec754a8/mm2src/rpc_task/src/manager.rs#L190-L193
and the task result will be stored/cached indefinitely through KDFs session life time.

We should rather convert the tasks Map to a TimedMap instead that will remove the task results that has been sitting there for an hour or so. This also means that forgotten tasks from clients will not cause memory leak in KDF.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: streamingimprovement: resource usageImprovements made on resource usage on runtime or/and compile timepriority: lowTasks with low importance that can be addressed when time permits.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions