Quota limit at particular time

Hi I like to keep quota at particular time to accept request as an example at 12:00pm to 1:00pm after 24 hours again it has to accept same particular time in quota

every 24 hours.it has to reset quota and accept request at particulat time.

Is there any possiblity to accept like this in quota

If there any possibility Please suggest some example.


@Siddharth Barahalikar @Dino-at-Google @Girish Gajria.

0 1 184
1 REPLY 1

I like to keep quota at particular time to accept request as an example at 12:00pm to 1:00pm after 24 hours again it has to accept same particular time in quota.

I don't understand the exact requirement.

It sounds like you want a "daily quota"... and then... I'm not sure what the 1200pm-100pm time window has to do with anything.

The daily resetting quota is easy. You want a calendar or "Default" quota, and use a time unit and interval of 1 day.

As regards the 12-1pm window, Maybe you could explain more practically.

A call arrives at 1159am. what do you want to happen?

A call arrives at 1200pm. what do you want to happen?

A call arrives at 1259pm. what do you want to happen?

A call arrives at 100pm. what do you want to happen?

If you want to restrict calls so that only calls that arrive between 1200pm and 100pm each day are allowed, independent of any quota you want to enforce, you could enforce that by examining the current date. This is easy in a JavaScript policy. It would look something like:

var d = new Date(); // current date
var hour = d.getUTCHours();
if (hour != 12) {
  throw new Error("outside of allowed time window");
}

(FYI: An error thrown from a JavaScript policy will cause the proxy to enter fault processing)

That code looks pretty easy, and ... it's a little too easy. There are a couple problems you need to sort out:

  1. Daylight savings time. Not sure what your preference is there.
  2. timezone. This logic looks at the UTC time - aka Greenwich time. That's probably not your local time. You'll have to figure out how to convert UTC time to the timezone that you want the 12pm to be relative to.

These two problems are related.

I haven't thought too much about it, but off the top of my head on a Friday night, I don't see an easy way to do the timezone arithmetic in a simple JavaScript policy.

You might need to use an external timezone offset value, stored in the KVM or in the policy config (as a property), to translate from UTC to your desired local timezone. That timezone offset changes over the course of the year if your area uses DST. (DST: quite possibly the dumbest idea ever)