Skip to content

Support for scheduled functions #51

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

Merged
merged 1 commit into from
Feb 19, 2020

Conversation

rhodgkins
Copy link
Contributor

Description

Adds support for scheduled functions that use only the context parameter when called.

Also includes tests.

Code sample

const scheduledFunc = functions.pubsub.schedule('every 2 hours').onRun(async context => {
 // Do something
});

require('firebase-functions-test').wrap(scheduledFunc)();

// Or with a context
require('firebase-functions-test').wrap(scheduledFunc)({ timestamp });

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@mbleigh
Copy link

mbleigh commented Dec 10, 2019

@laurenzlong this seems like a reasonable thing to do, but I'm not as familiar with the codebase to know if this is the reasonable way to do it. Can you take a look?

@rhodgkins
Copy link
Contributor Author

Just to note I'm not really up to scratch with TypeScript so I have no idea if the way I've changed the wrap function signature is the best way to go about things...!

Copy link
Contributor

@laurenzlong laurenzlong left a comment

Choose a reason for hiding this comment

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

Looks pretty good so far! Thanks for the contributions! It could use a bit of refactoring, but the implementation is correct otherwise.

@rhodgkins rhodgkins force-pushed the scheduled-functions branch from 5b41c0f to 5d6d03f Compare January 21, 2020 10:32
@rhodgkins
Copy link
Contributor Author

@laurenzlong sorry for the delay. I rebased from master and ran the new prettifier and then implemented the change you requested.

@rhodgkins rhodgkins requested a review from laurenzlong January 25, 2020 13:26
@rhodgkins
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@rhodgkins
Copy link
Contributor Author

@laurenzlong / @mbleigh is it possible to get this reviewed and merged in - thanks!

@laurenzlong laurenzlong merged commit d26d559 into firebase:master Feb 19, 2020
@laurenzlong
Copy link
Contributor

@rhodgkins thanks for the reminder! Sorry I missed the updates. Thanks again for the contribution! This will be in the 0.2.0 release.

@rhodgkins rhodgkins deleted the scheduled-functions branch February 20, 2020 16:29
@rhodgkins
Copy link
Contributor Author

Thanks @laurenzlong - any ideas when v0.2.0 will be released?

@laurenzlong
Copy link
Contributor

We're working on a new release process so it'll be a few days but hopefully not longer than that.

@laurenzlong
Copy link
Contributor

@rhodgkins It's released now!

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.

4 participants