Schedule firebase cloud function [duplicate] - firebase

This question already has answers here:
Cloud Functions for Firebase trigger on time?
(3 answers)
Closed 4 years ago.
Is there a simple way to schedule a cloud function to run in the future?
For example I'm making a game that is turn based. If a player doesn't act in time, say a time limit of 10 seconds then the turn should go to the next player.

You can try a pub/sub method which I think suits better for your needs. See related article here.

Related

Firebase, is there anything better than a cloud scheduler? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
When some information is stored in the firestore, each document is storing some specific time in the future, and according to that time, the event should occur in the user's app.
The first way I could find was the Cloud Function pub sub scheduler. However, I could not use this because the time is fixed.
The second method was to use Cloud Function + Cloud Task. I have referenced this. https://medium.com/firebase-developers/how-to-schedule-a-cloud-function-to-run-in-the-future-in-order-to-build-a-firestore-document-ttl-754f9bf3214a
This perfectly performed the function I really wanted, but there was a fatal drawback in the Cloud Task, because I could only save the event within 30 days. In other words, future time exceeding 30 days did not apply to this.
I want this event to be saved over the long term. And I want it to be somewhat smooth for large traffic.
I`m using Flutter/Firebase, how to implement this requirements above?
thank you for reading happy new year
I know this is not a satisfying answer, but my previous company had similar challenges, and we ended up going with using Cloud Function pub sub scheduler to invoke function every minute. Basically we invoked cloud function every minute and see if there are unprocessed queues. I wish if there were a better way of scheduling a function in the future, but I believe this is as good as it gets as of right now.

How to automatically remove data from firestore after a specific time? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am developing an app in flutter where I have a stories section. Where users can upload stories ( Text / Images). What I want is to automatically delete the posts after one day.
What I have achieved is to delete one day ago data by checking the timestamp of the post and a simple calculation and a remove call to delete it.
But what I want to achieve is an automated process. Like data is automatically deleted after one day without checking for posts on random calls or time. Like I don't know if it's possible or not. But if someone has a solution it would be a great favour. Thakns
Before displaying an item you can check if it is posted in the last 24 hours and if not then don't display it.
To delete the items from Firestore you can set a scheduled job in the backend.
You can use cloud functions pubsub. Write a function like "every one hour find & delete the items that are created before the last 24 hours". Take a look here Schedule functions.

Store Firebase Real Time Database data in Firestore? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I'm trying to figure out if it's possible to automatically have firebase database data be stored as different documents in Firestore? I've thought of trying to use Cloud Functions to achieve this, but I'm not familiar with javascript at all.
I'm an engineering student working on an automated garden project. I decided that it would be cool to have an app that updates with the real-time data (updated every 5min) as well as historical data that shows all of the previous update values. I've got an ESP8266 coded from Arduino IDE to update my Realtime Database with the sensor values, but I can't figure out the best way to store these values in order to view the historical data. If there is a better way of doing this I'm all ears.
I'm trying to figure out if it's possible to automatically have firebase database data be stored as different documents in Firestore? I've thought of trying to use Cloud Functions to achieve this, but I'm not familiar with javascript at all.
Yes, it's possible, and yes, you can use Cloud Functions for this. You don't have to be familiar with JavaScript as Cloud Functions supports several languages in Google Cloud Platform. The Firebase tools only support JavaScript, but you don't have to use that if you don't want to.

Advice on structuring an social science experiment in Meteor [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am playing around with Meteor as a framework for building web-deployed economics experiments. I am seeking advice on how to structure the app.
Here is the logic:
Users create an account and are put in a queue.
Groups of size N are formed from users in the queue.
Each group proceeds together through a series of stages.
Each stage consists of:
a. The display of information to and collection of simple input from group members.
b. Computing new information based on the inputs of all group members.
Groups move from stage to stage together, because the group data from one stage provides information needed in the next stage.
When the groups complete the last stage, data relating to their session is saved for analysis.
If a user loses their connection, they can rejoin by logging in and resume the state they were in before.
It is much like a multiplayer game, and I know there are many examples of those, so perhaps the answer to my question is just a pointer to a similarly structured and well-developed Meteor game.
I'm writing a framework for deploying multi-user experiments on Meteor. It basically does everything you asked for and a lot more.
https://github.com/HarvardEconCS/turkserver-meteor
We should talk! I'm currently using this for a couple of experiments but it is not well documented yet. However, it is a redesign of https://github.com/HarvardEconCS/TurkServer so all of the important features are there. Also, I'm looking to broaden out from using Amazon Mechanical Turk for subject recruitment, and Meteor makes that easy.
Even if you're not interested in using this, you should check out the source for how people are split into groups and kept segregated. The original idea came from here, but I've expanded on it significantly so that it is automagically managed by the smart package instead of having to do it yourself.

How can I stop/delay the code for a few seconds? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How do I get my C# program to sleep for 50 msec?
Is there any Delay() or sleep() in ASP.net to stop the application for some time?
System.Threading.Thread.Sleep(numberOfMilisecondsToSleep)
See the documentation for further details. Generally, this isn't something you would have to do in an ASP.NET application very frequently. It will just make the request seem slower.

Resources