Skip to content

Optimize ARC upload by passing raw JSON string to ApiClient #27

@Zalfsten

Description

@Zalfsten

Currently, the objects are serialized to a JSON string within the worker processes (to optimize IPC and memory) but must be deserialized back into a dictionary in the main process because the method only accepts an ARC or an dict object. This results in an unnecessary double-serialization/deserialization hop since the eventually serializes the dictionary again to send it via HTTP.

Once the api_client is updated to support raw JSON strings (see fairagro/m4.2_advanced_middleware_api#191), we should update the method in to pass the string directly.

Current logic in processor.py:

# Unnecessary double-hop
arc_dict = json.loads(arc_json)
await ctx.client.create_or_update_arc(rdi=ctx.rdi, arc=arc_dict)

Proposed optimization:

# Pass raw JSON string directly (planned ApiClient update)
await ctx.client.create_or_update_arc(rdi=ctx.rdi, arc_json=arc_json)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions