Skip to content

Use bun as a task executor #477

Open

Description

@seveibar

Feature description

Document or provide method to run graphile worker with Typescript tasks using bun

Motivating example

I use bun for a project, and would like to use it inside my tasks, but the instructions in the graphile worker docs only shows how to use ts-node with graphile worker (shown below)

image

Supporting development

I...

  • am interested in building this feature myself
  • am interested in collaborating on building this feature
  • am willing to help testing this feature before it's released
  • am willing to write a test-driven test suite for this feature (before it exists)
  • am a Graphile sponsor ❤️
  • have an active support or consultancy contract with Graphile

Activity

  1. seveibar commented on Jun 18, 2024

    @seveibar
    Author

    This is possible by running bunx --bun graphile-worker .... The --bun flag essentially replaces internal calls to node. It's a pretty simple solution. I can test it out for a couple days just to make sure it's not a totally broken way to do it, then can PR documentation for it (assuming that's ok w/ @benjie)

    image

  2. benjie commented on Jul 1, 2024

    @benjie
    Member

    I think adding something to the docs saying something along the line of the following would be good 👍

    While bun is not an officially supported runtime for Graphile Worker, users have reported success when executing bunx --bun graphile-worker. The --bun is necessary to ensure that child processes also run using bun rather than node.

  3. andrioid commented on Jan 12, 2025

    @andrioid

    I have a worker/index.ts file that runs the runner from a bun index.ts package.json script.

    import { run } from "graphile-worker";
    import preset from "./graphile.config";
    
    async function main() {
      const runner = await run({ preset });
      await runner.promise;
    }
    
    main().catch((err) => {
      console.error(err);
      process.exit(1);
    });

    It works well, and cuts through a lot of the TypeScript packaging pain points. However, I am noticing memory leaks that I suspect have something to do with Bun. So, use at your own risk 😄

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions