Rails DB Connections on SNS topics

Hey there,

I was wondering if you could shed some light on how to best handle DB connections on functions that don’t actually need them? For example, I have a function that runs every X minutes and sends SNS notifications for required action items. One of those items, for exmaple, is sending email. So technically I need to load up all my activemailers. So I would naturally choose a Job to do this (instead of a Function). However, if it queues up 5000 SNS notifications it will spin up lots of instances and overload the connections to my postgres when its not really required.

Or would you suggest using a function and manually/selectively including gems to fulfill this functionality?