0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Fixed batch size when sending bulk emails

- during a refactor, I moved the `BATCH_SIZE` variable around
- putting the variable export above a more general export means it get
  overwritten and the value is `undefined` outside of the module
- when we chunk the emails, we were chunking in sized of `undefined`,
  so I'm guessing it just defaulted to 1
- this means the email batches were of size 1 instead of 1000 - oops
This commit is contained in:
Daniel Lockyer 2022-08-18 21:58:43 +02:00
parent f2c6ccf3e5
commit fd6f48d6b2
No known key found for this signature in database
GPG key ID: D21186F0B47295AD
2 changed files with 6 additions and 2 deletions

View file

@ -2,8 +2,6 @@ const _ = require('lodash');
const debug = require('@tryghost/debug');
const logging = require('@tryghost/logging');
module.exports.BATCH_SIZE = 1000;
module.exports = class MailgunClient {
#config;
#settings;
@ -208,3 +206,5 @@ module.exports = class MailgunClient {
return !!instance;
}
};
module.exports.BATCH_SIZE = 1000;

View file

@ -25,6 +25,10 @@ describe('MailgunClient', function () {
sinon.restore();
});
it('exports a number for BATCH_SIZE', function () {
assert(typeof MailgunClient.BATCH_SIZE === 'number');
});
it('can connect via config', function () {
const configStub = sinon.stub(config, 'get');
configStub.withArgs('bulkEmail').returns({