bahrmichael / aws-scheduler

A scheduler for large amounts of time precise events

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: Any Delay limit?

itsazzad opened this issue · comments

Is there any delay limit?
Can I use up-to one year?
I can see it using time.sleep(delay). So it's a blocking code. Will that really be feasible?
How may I be billed in the AWS Lambda for a one year sleep?

Hi, there's not delay limit. You could delay for multiple years.

If the delay is more than 15 minutes away, records will first be stored in DynamoDB. Once they are 15 minutes or closer, they are put into SQS, which makes them visible a few seconds before release. Then the lambda function uses the time.sleep to catch the right instant and send the event back.

Your Lambda function is only running for a few seconds at most.

Hi, there's not delay limit. You could delay for multiple years.

If the delay is more than 15 minutes away, records will first be stored in DynamoDB. Once they are 15 minutes or closer, they are put into SQS, which makes them visible a few seconds before release. Then the lambda function uses the time.sleep to catch the right instant and send the event back.

Your Lambda function is only running for a few seconds at most.

How is that being handled?
I can see https://github.com/bahrmichael/aws-scheduler/blob/master/emitter.py#L56-L57

        if delay > 0:
            time.sleep(delay)

How can that even be related to DynamoDB!? Can you please guide me? I am just confused :(

I think I have got the idea.
The consumer is saving without delay.
So in consumer, if the event has less than 10 minutes until execution, then fast track it otherwise saving in DB.
Emitter is using the delay as it is getting in the queue a few seconds(less than 20 seconds) before the release and so time.sleep for only a few seconds(timeout in 20 seconds).
Sorry for misunderstanding.

Correct :) The emitter doesn't care about SQS or DDB, just about how much time is left until the time that was initially specified.