Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add support for cron triggers in dev --local mode #738

Merged

Conversation

petebacondarwin
Copy link
Contributor

Currently, I don't know if there is support for doing this in "remote" dev mode.

Resolves #737

@changeset-bot
Copy link

changeset-bot bot commented Mar 31, 2022

🦋 Changeset detected

Latest commit: f8b3356

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
example-worker-app Patch
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 31, 2022

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2073353686/npm-package-wrangler-738

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/738/npm-package-wrangler-738

Or you can use npx with this latest build directly:

npx https://prerelease-registry.developers.workers.dev/runs/2073353686/npm-package-wrangler-738 dev path/to/script.js

@threepointone
Copy link
Contributor

Happy to merge this, but registering some caveats/concerns for when we revisit this later -

  • We've resisted adding miniflare specific features that don't have edge equivalents, but this seems like a good exception to make.
  • That said, let's consider this experimental, and not make too much noise about it for now. This will definitely change in the future.
  • We could probably make this work on the edge too. For module workers, we could wrap the worker in a facade that exposes a route that triggers the default.scheduled export. For service workers, we'd have to override addEventListener and wrap the fetch handler with our own thing.

Let's land this right now, and discuss further in #570.

Copy link
Contributor

@threepointone threepointone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! one formatting nit, but let's land it.

main = "src/index.js"

[triggers]
crons = ["1 * * * *"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
crons = ["1 * * * *"]
crons = ["1 * * * *"]

Currently, I don't know if there is support for doing this in "remote" dev mode.

Resolves cloudflare#737
@threepointone
Copy link
Contributor

sorry for the conflict, rebased this for you!

@petebacondarwin petebacondarwin merged commit c04791c into cloudflare:main Apr 1, 2022
@github-actions github-actions bot mentioned this pull request Apr 1, 2022
@petebacondarwin petebacondarwin deleted the local-cron-support branch April 1, 2022 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Schedule tasks from http://localhost:8787/cdn-cgi/mf/scheduled
2 participants