If I make a Foursquare API (Venue Details API) call say exactly at 12:00 PM and consume all the hourly rate limit by 12:15 PM then when does Foursquare will refresh the rate limit again so that I can make calls in the next call ?
In other words if my API call limit is 500 at 12:00 PM then will it be reset again at 01:00 PM.
How does FourSquare maintain the hourly limit of an API. Is the window fixed i.e. 12.00 pm to 1.00 PM then 1.00 PM to 2.00 pm or so or it maintains the hour from the first API call ?
The rate limit window is rolling (i.e. it doesn't use fixed hourly buckets)
Related
I have a LogicApp which runs for every 2 minutes. All runs in this LogicApp has failed between 4:45pm to 5:00pm.
when I check for the metric Run Failure Percentage under 'Metrics' in the Azure portal with time granularity as 15 minutes and aggregation as Average, it shows me Run Failure Percentage as 114.29% for time window 4:45 pm to 5:00 pm.
My question is, how the metric value is calculated? shouldn't it be less than 100 for percentage?
DcoumentDB has a minimum billing time of 1 hour.
How much would the following cost?
I create a collection (400Ru/s) at time 01:00
I upgrade the collection 1000Ru/s to a total of 1400Ru/s at time 01:30
I downgrade the collection back to 400Ru/s at time 02:15
I delete the collection at 02:45
Will I be charged 400Ru/s for 2 hours + 1000Ru/s for 1 hour
Or
Will I be charged 400Ru/s + 1000Ru/s for 2 hours?
I ask as it would depend on how the billing clock works, I could see it being the latter as I was at 1400Ru/s at 01:00 & 02:00 hours. Although I only used the upgrade for less than 1 hour.
Great question! Based on the FAQs provided here, you will be charged for 1400RU/s for both hours. If I am understanding the FAQs correctly, you will be charged the maximum RU/s provisioned in a clock hour (i.e. between 1:00 and 2:00, 2:00 and 3:00 etc.)
From the documentation link:
What if my container is active for less than an hour?
You are billed the flat rate for each hour the container exists,
regardless of usage or if the container is active for less than an
hour. For example, if you create a container and delete it 5 minutes
later, your bill will reflect a charge for 1 unit hour.
When does the billing rate change after I upgrade a container?
If you define your own performance for a container and you upgrade at
9:30AM from 400 RUs to 1,000 RUs and downgrade at 10:45AM back to 400
RUs, you will be charged for two hours of 1,000 RUs.
I want to create single cron job for UTC time and send notification to users according to their timezone time.
You can follow the below steps to send notifications to user's timezone.
Create a Cronjob (Set the interval according to your requirement)
Now fetch all users records.
Get every user's timezone.
Now, convert your datetime to user's timezone.
Match your current time to user's timezone time
If the time matches according to the user's timezone, then send notification to that user only.
Updated, for example a user has timezone GMT +530 and you server has timezone GMT 0 then if you get the user's record whose notification time is 4:30 PM and at the same time your server time would be 11:00 AM. Now the cronjob runs at 11:00 AM, according to that user timezone you need to add 5:30 hours in your current time so 11:00 AM + 5:30 = 4:30 PM(be careful with the date too) which is your user's time, and in that case you can send notification to him.
And if you don't want to set cron for each minute then you can set marginal minutes for checking. Suppose your cron runs in every 10 minutes then you have to check the condition like converted_time >= 4:20 and converted_time < 4:30. (Remember the >= and < combination here)
When I go to configure a Schedule in the Azure management console, I'm only given the option of scheduling with an absolute end date/time (or never ending) and an interval.
So I can't, from this UI, schedule a job to every 30 minutes run every day from 8:00 AM to 6:00 PM only (i.e. don't run from 6:01 PM to 7:59 AM). Windows Task Manager and all other schedulers (cron, quartz) I've used before support the behaviour I want.
Is type of schedule supported at all in Azure, e.g. through the API or a hackish use of the Portal HTTP/JSON interfaces?
You can use the built-in scheduling which is more flexible than the Azure one.
You can learn more about how that works from this blog post http://blog.amitapple.com/post/2015/06/scheduling-azure-webjobs/
The summary: create a file called settings.job that contains the following piece of json
{"schedule": "cron expression for the schedule"}
in your case the cron expression for "every 30 minutes from 8am to 6pm" would be 0,30 8-18 * * *
so the JSON you want is
{"schedule": "0,30 8-18 * * *"}
Keep in mind that this uses the timezone of the machine, which is UTC by default.
This is something you need to implement in your WebJob. I have a similar issue in that I have WebJobs with complex schedules. Fortunately it isn't hard to implement.
This snippit gets your local time (Eastern from what I can tell) from UTC which everything is Azure is set to. It then checks if it is Saturday or Sunday and if it is exits out (not sure if you need this). It then checks whether it is before 8AM or after 6PM and if it is exits out. If it passes both those conditions the WebJob runs.
//Get current time, adjust 4 hours to convert UTC to Eastern Time
DateTime dt = DateTime.Now.AddHours(-4);
//This job should only run Monday - Friday from 8am to 6pm Eastern Time.
if (dt.DayOfWeek == DayOfWeek.Saturday || dt.DayOfWeek == DayOfWeek.Sunday) return;
if (dt.Hour < 8 || dt.Hour > 16) return;
//Go run WebJob
Hope this helps.
According to GitHub's API documentation, when you go over the rate limit, you get a response that looks like this:
HTTP/1.1 403 Forbidden
Date: Tue, 20 Aug 2013 14:50:41 GMT
Status: 403 Forbidden
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1377013266
{
"message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
"documentation_url": "https://developer.github.com/v3/#rate-limiting"
}
What are the units on the X-RateLimit-Reset value? In other words, how can I tell from the error message how long in seconds or minutes I need to wait before I can send another request?
It's a Unix timestamp, see this note from the GitHub API documentation.
With the timestamp from that example the reset time would have been 20 Aug 2013 at 15:41:06.
According to a Wikipedia article the GitHub docs link to, a Unix timestamp is:
defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds.