mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-10-23 06:55:45 +07:00
node_modules: update (#352)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
4026a70a6b
commit
47af4a10b5
53 files changed
+630
-217
No files matched your search
+11
@@ -110,6 +110,17 @@ declare class SMTPPool extends EventEmitter {
|
||||
* Returns true if there are free slots in the queue
|
||||
*/
|
||||
isIdle(): boolean;
|
||||
/**
|
||||
* Counts the messages the pool has not finished with yet: the ones waiting in the queue
|
||||
* plus the ones a connection is transmitting right now. isIdle() only tells whether the
|
||||
* pool can take another message, it is already true while a message is still being sent,
|
||||
* so use this to check that nothing would be lost by closing the pool. A message that is
|
||||
* re-queued after its connection dropped is counted until its callback runs, also while it waits to be put back on the queue, and
|
||||
* it is no longer counted by the time its callback runs.
|
||||
*
|
||||
* @returns Number of queued and in-flight messages
|
||||
*/
|
||||
pendingCount(): number;
|
||||
/**
|
||||
* Verifies SMTP configuration
|
||||
*
|
||||
|
||||
+25
-1
@@ -62,6 +62,7 @@ class SMTPPool extends EventEmitter {
|
||||
this._queue = [];
|
||||
this._connections = [];
|
||||
this._connectionCounter = 0;
|
||||
this._pending = 0;
|
||||
this.idling = true;
|
||||
setImmediate(() => {
|
||||
if (this.idling) {
|
||||
@@ -94,10 +95,20 @@ class SMTPPool extends EventEmitter {
|
||||
setImmediate(() => callback(err));
|
||||
return false;
|
||||
}
|
||||
// counted until the callback runs, whichever path runs it: delivered, failed, requeued
|
||||
// until it gives up, or drained by close()
|
||||
let counted = true;
|
||||
this._pending++;
|
||||
this._queue.push({
|
||||
mail,
|
||||
requeueAttempts: 0,
|
||||
callback
|
||||
callback: (err, info) => {
|
||||
if (counted) {
|
||||
counted = false;
|
||||
this._pending--;
|
||||
}
|
||||
callback(err, info);
|
||||
}
|
||||
});
|
||||
if (this.idling && this._queue.length >= this.options.maxConnections) {
|
||||
this.idling = false;
|
||||
@@ -441,6 +452,19 @@ class SMTPPool extends EventEmitter {
|
||||
isIdle() {
|
||||
return this.idling;
|
||||
}
|
||||
/**
|
||||
* Counts the messages the pool has not finished with yet: the ones waiting in the queue
|
||||
* plus the ones a connection is transmitting right now. isIdle() only tells whether the
|
||||
* pool can take another message, it is already true while a message is still being sent,
|
||||
* so use this to check that nothing would be lost by closing the pool. A message that is
|
||||
* re-queued after its connection dropped is counted until its callback runs, also while it waits to be put back on the queue, and
|
||||
* it is no longer counted by the time its callback runs.
|
||||
*
|
||||
* @returns Number of queued and in-flight messages
|
||||
*/
|
||||
pendingCount() {
|
||||
return this._pending;
|
||||
}
|
||||
verify(callback) {
|
||||
let promise;
|
||||
if (!callback) {
|
||||
|
||||
+2
-5
@@ -19,8 +19,7 @@ export default class PoolResource extends EventEmitter {
|
||||
switch ((this.options.auth.type || '').toString().toUpperCase()) {
|
||||
case 'OAUTH2': {
|
||||
const oauth2 = new XOAuth2(this.options.auth, this.logger);
|
||||
oauth2.provisionCallback =
|
||||
(this.pool.mailer && this.pool.mailer.get('oauth2_provision_cb')) || oauth2.provisionCallback;
|
||||
oauth2.provisionCallback = (this.pool.mailer && this.pool.mailer.get('oauth2_provision_cb')) || oauth2.provisionCallback;
|
||||
this.auth = {
|
||||
type: 'OAUTH2',
|
||||
user: this.options.auth.user,
|
||||
@@ -208,9 +207,7 @@ export default class PoolResource extends EventEmitter {
|
||||
this.connection.close();
|
||||
return;
|
||||
}
|
||||
if ((err.code === errors.EENVELOPE || err.code === errors.EMESSAGE) &&
|
||||
err.responseCode !== 421 &&
|
||||
!this.connection._destroyed) {
|
||||
if ((err.code === errors.EENVELOPE || err.code === errors.EMESSAGE) && err.responseCode !== 421 && !this.connection._destroyed) {
|
||||
// The server refused this message, the connection itself is fine. Reset the
|
||||
// session and keep using it instead of opening a new one
|
||||
this.connection.reset(resetErr => {
|
||||
|
||||
Reference in new issue
Block a user