3 ms·
Presumably people are unsubbing all day. If n is the number of emails and k is the number of unsubs, it adds up to O(n) to check the table of unsubs before sen
by sjaknanxnnx 7y ago
Presumably people are unsubbing all day.
If n is the number of emails and k is the number of unsubs, it adds up to O(n) to check the table of unsubs before sending vs. O(k*n) to scan the queue after every unsub.
Or, to be less computer-sciency, a task that scans the queue of emails every time someone unsubs would be a pain to keep running. Elsewhere in this discussion the queue was described as a file. Who wants to scan the same file over and over all day?
- megous 7y agoYes, but all that is easy to optimize. You can scan the mail file on entry to the queue and store file path/recipients to an indexed database. Then removal is just one SELECT query and unlink() call.