Skip to content

Reliable way to tell whether server is running #1001

Open

Description

@king-of-poppk

Currently, the startup message "Running plumber API at ..." is printed before this line is reached:

httpuv::runServer(host, port, self)

which makes it difficult to time when the server is actually started (think tests).

One way to fix this is to print that message (and possibly also "Running swagger Docs at ..."), or something else, between httpuv::startServer and httpuv::service here, by using those directly instead of relying on the httpuv::runServer abstraction.

Activity

  1. ElianHugh commented on Jan 18, 2026

    @ElianHugh

    FWIW, a workaround is to have a dummy endpoint and ping it using httr2/whatever and return FALSE on error

    I use this pattern in my autoreloader to check if the api is up

    https://github.com/ElianHugh/hotwater/blob/main/R/middleware.R#L85-L105

  2. schloerke commented on Jan 20, 2026

    @schloerke
    Collaborator

    I believe the messages could be printed in a later::later(function() { message("SERVER STARTED") }, delay = 0). This would delay the message until the R process releases control back to {later} processing loop.

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