How to run two schedules to the same function at the same time?

Hello guys, Is there anyone having issues to run a lambda function with multiple schedules?
For example, Im runnning a function with the following crons
cron(*/15 * * * ? )
cron(
/30 * * * ? *)
And this is causing my lambda function to go haywire

I’m getting callback was already called errors and I’m pretty sure that my code is ok…
For example when it is running at 20h15 and 20h45 my code is running great, but when it gets called at 20h30 and 21h00 due to the clash of the functions It’s doing some crazy stuff

Hmm, haven’t tried it myself. I would’ve assumed it worked, but errors like that suggest that there’s something more going on. Are you sure there’s no global variable in your code (i.e. everything is scoped correctly)? If the warm container is already being caused, there might be some “bleed” between the two.

If you just want it to work, why not just create two separate functions? The only downside I can see is that you’ll have to pay for two CWE Rules, but you won’t incur any additional Lambda costs - you only pay for the GB Seconds you use.

Yep just figured it out that sometimes the container is kept for the lambda function, so when there are variables that are not inside the handler scope their state are kept.

I didn’t know about this behaviour. =(

From the meetup last night, check out:

Slides 10 and 11 discuss some of the limit testing that the IOpipe team has done. Super interesting stuff.

1 Like