Skip to content

Int64 Job Args Lose Precision #395

Description

@TheRedPanda17

I am experiencing an issue when passing large int64 arguments to a job. I try passing 3889108265204450030 for example, and end up receiving 3889108265204450000.

After looking into it, I think this is caused by using the default json decoder when unmarshaling a job (I believe it's here: https://github.com/contribsys/faktory/blob/main/client/client.go#L345). In order to keep precision on int64, it would have to be something like this instead:

var job Job
decoder := json.NewDecoder(bytes.NewBuffer(data))
decoder.UseNumber()
decoder.Decode(&job)

Is this a change you would be interested in? I plan to work around this by encoding and decoding it myself and passing faktory a string, but it might be a helpful thing to add.

I am using Faktory v1.6.0 with faktory_worker_go.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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