Skip to content

Consider using gleam_time Duration instead of Int for timeouts #119

@blfpd

Description

@blfpd

The signature of actor.call is unclear of what magic number to put as the second argument.

pub fn call(
  subject: process.Subject,
  waiting timeout: Int,
  sending make_message: fn(process.Subject(reply)) -> message,
) -> reply

If a reply is not received within the given timeout then the sender process crashes rather than leaving the processes in an invalid state.

As Gleam is a typed language, I would expect a Duration for this kind of value, instead of a undocumented Int that must be in milliseconds.

Alternatives:

  • rename the parameter as timeout_ms
  • make it clear in the documentation that it expects milliseconds

What do you think?

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