Skip to content

Remove unnecessary JobId parameter from spawn_unique #89

@nicolasburtey

Description

@nicolasburtey

Context

From PR review discussion on lana-bank#4986.

The JobId parameter passed to spawn_unique is only meaningful on the first ever call, when no job row exists yet and the ID becomes the primary key. On every subsequent call (the common case), it's generated and silently discarded.

All callers always write job::JobId::new() — a fresh random UUID every time — which means the passed-in ID carries no semantic value. spawn_unique could simply generate the ID internally.

Current (suboptimal)

spawner.spawn_unique(job::JobId::new(), HourlyProducerJobConfig { ... }).await?;

Proposed

spawner.spawn_unique(HourlyProducerJobConfig { ... }).await?;

This would simplify the API and remove a parameter that provides no value to callers.

Related: #84

/cc @HonestMajority

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions