Skip to content

Codersdk/ts: migrate workspace ttl to ttl_ms Β #1707

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy