Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Codersdk/ts: migrate workspace ttl to ttl_ms  #1707

Closed as not planned
Closed as not planned
@johnstcn

Description

@johnstcn

TL;DR make all TTL references in codersdk be milliseconds instead of nanoseconds.

Initially when defining the external API for workspace time-to-live (TTL), I simply passed through the Golang time.Duration object as an int64. This is a nanosecond timestamp, which means that the typescript UI needs to multiply/divide any timestamps by 1 million.

This is a potential source of future time-bugs (the worst kind of bugs), so it would make sense to align the typescript API with what JS/TS generally uses for timestamps (milliseconds).

remark (non-blocking): in a follow-up PR, I think it could make sense to migrate `ttl` to `ttl_ms` in externally-facing API types so that we don't accidentally multiply by a million one way or another. Milliseconds seems to be the accepted unit of time in the TS/JS world.

Originally posted by @johnstcn in #1701 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiArea: HTTP APIstaleThis issue is like stale bread.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions