mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-11-21 21:06:12 +07:00
node_modules: update (#362)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
4a48500d96
commit
aefdaa6a6c
49 files changed
+1316
-295
No files matched your search
+26
-4
@@ -86,6 +86,7 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
}
|
||||
this._connection = false;
|
||||
this._connected = false;
|
||||
this._closed = false;
|
||||
this.messages = 0;
|
||||
this.available = true;
|
||||
this._failed = false;
|
||||
@@ -113,6 +114,10 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
// the proxy handshake, if any, counts against connectionTimeout as well
|
||||
const connectStartedAt = Date.now();
|
||||
this.pool.getSocket(Object.assign({}, this.options, { connectStartedAt }), (err, socketOptions) => {
|
||||
if (this._closed) {
|
||||
socketOptions && socketOptions.connection?.destroy();
|
||||
return;
|
||||
}
|
||||
if (err) {
|
||||
// nothing was connected, so no 'close' event is coming that would free the
|
||||
// slot this resource holds in the pool, report the failure the way a failed
|
||||
@@ -136,7 +141,7 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
this.connection = new index_js_1.default(options);
|
||||
this.connection._connectStartedAt = connectStartedAt;
|
||||
this.connection.on('error', (err) => {
|
||||
if (this._sending) {
|
||||
if (this._closed || this._sending) {
|
||||
// the send callback gets the same error and decides what it means for the message
|
||||
return;
|
||||
}
|
||||
@@ -150,7 +155,7 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
return;
|
||||
}
|
||||
this._fail(err);
|
||||
if (returned) {
|
||||
if (returned || this._closed) {
|
||||
return;
|
||||
}
|
||||
returned = true;
|
||||
@@ -161,7 +166,7 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
returned = true;
|
||||
});
|
||||
this.connection.connect(err => {
|
||||
if (returned) {
|
||||
if (returned || this._closed) {
|
||||
return;
|
||||
}
|
||||
if (err) {
|
||||
@@ -172,7 +177,7 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
}
|
||||
if (this.auth && (this.connection.allowsAuth || options.forceAuth)) {
|
||||
this.connection.login(this.auth, err => {
|
||||
if (returned) {
|
||||
if (returned || this._closed) {
|
||||
return;
|
||||
}
|
||||
returned = true;
|
||||
@@ -200,6 +205,9 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
* @param callback Callback function
|
||||
*/
|
||||
send(mail, callback) {
|
||||
if (this._closed) {
|
||||
return;
|
||||
}
|
||||
if (!this._connected) {
|
||||
return this.connect(err => {
|
||||
if (err) {
|
||||
@@ -231,6 +239,9 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
const reused = this.messages > 0;
|
||||
const messageStream = mail.message.createReadStream();
|
||||
this.connection.send(envelope, messageStream, (err, info) => {
|
||||
if (mail.data.signal?.aborted) {
|
||||
return;
|
||||
}
|
||||
this._sending = false;
|
||||
this.messages++;
|
||||
if (err) {
|
||||
@@ -277,6 +288,9 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
* @internal
|
||||
*/
|
||||
_release() {
|
||||
if (this._closed) {
|
||||
return;
|
||||
}
|
||||
if (this.messages >= this.options.maxMessages) {
|
||||
const err = new Error('Resource exhausted');
|
||||
err.code = errors.EMAXLIMIT;
|
||||
@@ -285,6 +299,9 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
return;
|
||||
}
|
||||
this.pool._checkRateLimit(() => {
|
||||
if (this._closed) {
|
||||
return;
|
||||
}
|
||||
this.available = true;
|
||||
this._startIdleTimer();
|
||||
this.emit('available');
|
||||
@@ -327,6 +344,11 @@ class PoolResource extends node_events_1.EventEmitter {
|
||||
* Closes the connection
|
||||
*/
|
||||
close() {
|
||||
if (this._closed) {
|
||||
return;
|
||||
}
|
||||
this._closed = true;
|
||||
this.available = false;
|
||||
this._connected = false;
|
||||
this._stopIdleTimer();
|
||||
if (this.auth && this.auth.oauth2) {
|
||||
|
||||
Reference in new issue
Block a user