Refresh Database/server every 60 minutes - database

How can I keep the server active and update the database every 60 minutes or after some specific time period ?
I am working on a project where the website updates the database per user.
If the user add something to the cart, the stock gets updated.
But if the user does not checkout within 60 minutes, the product gets removed from the cart and the stock gets updated again.
Now the problem : If no one visits the website for say 2 hours, how should I update the server/database ??
In short, how do I keep the server live without the website being visited by any user.
I want to set a timer for the server.
I hope someone understands what I am asking for.

You need to implement time scheduler or a listener which will run at in every 60 minutes, In time scheduler you implement the update database logic.

You can write a background service to perform this task or if you want it to happen through application only, in that case you can use scheduler like Quartz.
Check
JAVA http://www.quartz-scheduler.org/
.NET https://www.quartz-scheduler.net/

Related

eBuildfire: Notifications issue

I have created an app that uses push notifications to notify people about important events during their day. For a regular user, the app can create anywhere between 120 to 350 notifications every 7 days (we create all the notifications for the upcoming week). In some cases when users change their accounts, we are renewing the notification by canceling them and creating them again. This can happen 2 to 4 times in a span of a few minutes.
We had situations when the app users reported OLD notifications still being sent when those should have been canceled.
We tested this multiple times while adding logs for each notification that got canceled or added - and each time this worked ok - the logs matched the total we were expecting.
Is there a limitation to the number of notifications that can be canceled or added at one single time by the APP? Is there something that could break the requests?
Is there a way to see if the notifications got created or not, other than checking the response of the requests?
Thanks in advance!

How to add a banner with a message to Report Server Web Portal?

I have an SSRS Report Server web portal running which houses a few hundred reports, my users rely on this data being up to date to do their jobs.
Occasionally my overnight update process will fail, and reports will be updated during the working day, which takes a few hours.
During this time, I want to display a banner on the report server web portal, something like “all reports are being updated, ETA 3pm”.
Is there any way for me to modify the report server html to do that? It doesn’t have to look pretty, I just want to try and avoid all my users calling at once when their reports haven’t updated.
A nice simple way would be to just change the site name at the start and end of your job that refreshes the report data.
Use something like
UPDATE ReportServer.dbo.ConfigurationInfo
SET Value = 'My Company - REFRESH IN PROGRESS ETA 3PM'
WHERE [Name] = 'SiteName'
and then update again at the end of the job.
As this is simple to automate you could leave it in place in the refresh job.

How to schedule repeated jobs or tasks from user parameters in Google App Engine?

I'm using Google App Engine and I want like to be able to schedule jobs based users' parameters.
I know this can be done with cron jobs, but looks like it does not allow any flexibility from the user's point of view, but it allows only to schedule predefined jobs.
For example, suppose I have a news app where users can subscribe to different topics: I want the admin to be able to decide when to send a summary email, for instance, every day at 8am, and I want him to be able to edit this.
Is there anything that provides this?
You may want to star Issue 3638: Cron jobs to be scheduled programatically
Meanwhile you can write your own implementation: have a generic cron job running periodically (every 1 minute being the finest resolution) and inside that cron job check user-programmed scheduling data persisted somewhere (in the datastore for example) and, if needed, trigger execution of whatever is needed to be executed, either inlined or by enqueueing a task in some task queue.
It's possible to drive the scheduling resolution even under 1 minute, if needed, see High frequency data refresh with Google App Engine
For my debts tracking app DebtsTracker.io I've implemented it manually.
When a user creates a debt record he can specify due date that is stored in an unindexed DueDate and indexed ReminderDateTime fields.
I have a cron that query records with ReminderDateTime < today and sends notifications. Once notification sent the ReminderDateTime is set to null or far future so it's not picked in next cron run. If user hits Remind me again I am updating the ReminderDateTime to some date in future (user decides when).
If ReminderDateTime is closer then cron interval then I simply create I put a task to queue with appropriate delay.
This works very well and is very cheap to run.

Will the Database hustles if I update a field every 5 seconds?

I am developing a web app which needs to check the internet if got connection or not.
If got connection, it will update a field in the db every 5 seconds.
Basically, it's a chat-like web app wherein it will update a field for datetime last seen online.
So that it will show on the other users who is currently online/logged in.
I will implement the snipplet in all the pages so that it will update the DB while you navigating the pages.
Cheers!
No self respecting database should have an issue with that.

Update Whole Table every 5 minutes

We currently develop a portal in asp.net mvc2 with fluent nhibernate on amazon cloud servers which have lots of user which buying or selling shares. Also they comment every where and make other activities.
Portal is actually behave like multiple portals which we called Community. Our basic statistics based on users activity (buy,sell, comment etc). We have a basic structure called TopUsers. Which we show top user home page for all topics for loggedin community. On topic page we show top users for current topic etc.
Because of a lot of calculation I want to make a top users table. I am waiting for recommentations for this?
Your approach (separate table that gets periodically repopulated) is correct, except for the interval: your users will not be fanatically clicking on your site every minute to see updated stats, so after a certain threshold of data there isn't much point in refreshing your top users this often. Doing it once per day will usually be good enough.

Resources