I want to send message to user after 2 minute he has clicked an callback query and execute database automatically after that 2 minute .
Asked
Active
Viewed 277 times
-2
-
1"**Make a good faith attempt to solve the problem yourself first.** Users here respond negatively if your question gives them the impression that you're asking them to do your work for you." --> [Quoted from here](https://meta.stackoverflow.com/questions/334822/how-do-i-ask-and-answer-homework-questions) – Kuro Neko Jun 15 '22 at 07:32
-
Bro i didn't want sb to solve my problem instead of me .i just asked for a word that i could use to solve my problem with it.tnx :) – Seyed reza Asadi Jun 15 '22 at 09:22
2 Answers
0
You can create a table called jobs
and set a cron job to run every minute to check if there is any job to run. So you create a job for doing what you want and consider a column named runs_at
.
id | command | runs_at |
---|---|---|
1 | { "class_name": "DatabaseQueryJob", "parameters": { ... } } |
2022-06-15 15:22:00 |
You have a class for running database queries and save what you need in parameters. Delete executed jobs from table and that's it.
I hope this idea solves your problem and let me know if I misunderstood you.

WebPajooh
- 442
- 1
- 3
- 12
-
I used cron jobs bro but they are 1 minute period time .i want a realtime system to run extra code beside my main code every second:) – Seyed reza Asadi Jun 15 '22 at 09:26
-
I used cron jobs bro but they are 1 minute period time .i want a realtime system to run extra code beside my main code every second or after exactly a time defined by myself after user's reaction :) – Seyed reza Asadi Jun 15 '22 at 09:36