4

I am new on firebase cloud functions. I would like to ask a question about always running or self-triggering functions. How can we handle these things? How can we implement always running functions or self-triggering?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
E.T.Tuna
  • 85
  • 1
  • 6
  • 1
    By essence Cloud Functions are implementing a serverless architecture: they don't run all the time (i.e. permanently), but when they are triggered. You could more or less simulate that by calling an HTTP Cloud function with a CRON job (but I am not sure it is a good idea to call a function via CRON with a very small interval...) – Renaud Tarnec Apr 25 '18 at 11:07
  • @RenaudTarnec thank you for replying. Then, we need to trigger them somehow. – E.T.Tuna Apr 25 '18 at 11:36
  • 1
    What is your exact business (i.e. fonctionnal) requirement? – Renaud Tarnec Apr 25 '18 at 12:13
  • 1
    @RenaudTarnec A function of an app that keeps track of currencies. For example, keep looking at dolar/eur level and then notify me when it gets 1 or something. And another thing, keep looking at social media such as twitter and if a tweet includes USDEUR, then notify me. These kinds of things... – E.T.Tuna Apr 25 '18 at 16:54

1 Answers1

6

Google Cloud Functions are snippets of code that run in response to events that happen somewhere else. Some example events:

There is no concept on a forever-running function on Cloud Functions (nor on other, similar Functions-as-a-Service offerings), although it's definitely possible to create a function that gets triggered every minute or so (like a cron job).

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807