Ability to limit size of job data
Created by: gabegorelick
Feature request
Many queues have upper limits for the size of messages that you can send through them. For example, SQS limits messages to 256 KB.
Such limits are really important for a queue backed by Redis, since memory may be limited: you don't want someone enqueuing 1GB jobs!
Bull should check the size of jobData
and return an error if it's larger than a configurable limit:
https://github.com/OptimalBits/bull/blob/c0ee6be03c6d47d60465d2bae0d2566d5bf0d661/lib/job.js#L61-L64
Since it has to serialize job data to a string anyway, Bull should be able to approximate the size a job would occupy in Redis by checking the length of the serialized string: https://github.com/OptimalBits/bull/blob/c0ee6be03c6d47d60465d2bae0d2566d5bf0d661/lib/job.js#L132-L135