@icgio/icg-utils 1.7.34 → 1.7.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/mail.js CHANGED
@@ -25,33 +25,3 @@ module.exports.send = function (address, subject, data, config) {
25
25
  }
26
26
  })
27
27
  }
28
-
29
- module.exports.send_cn = function (address, subject, data, config, cd) {
30
- let transporter = nodemailer.createTransport({
31
- host: config.mail_smtp_server,
32
- port: 465,
33
- secure: true,
34
- auth: {
35
- user: config.mail_from_address_china,
36
- pass: cd.mail_user_password,
37
- },
38
- })
39
- let options = {
40
- from: config.mail_from_address_china,
41
- to: address,
42
- subject: subject,
43
- }
44
- if (/<[a-z][\s\S]*>/i.test(data)) {
45
- options.html = data
46
- options.text = ''
47
- } else {
48
- options.text = data
49
- options.html = ''
50
- }
51
- transporter.sendMail(options, (err, body) => {
52
- if (err) {
53
- return logger.error('Mail sent error: %j', err)
54
- }
55
- logger.info('Mail sent successfully: %j', body.response)
56
- })
57
- }
@@ -2,6 +2,7 @@ module.exports = class RateLimiter {
2
2
  constructor(settings) {
3
3
  this.max_concurrent = settings.max_concurrent ? settings.max_concurrent : null
4
4
  this.interval_concurrent = settings.interval_concurrent ? settings.interval_concurrent : null
5
+ this.abandon_tx = settings.abandon_tx ? settings.abandon_tx : false
5
6
  this.count = 0
6
7
  }
7
8
  process(func, ...args) {
@@ -17,7 +18,7 @@ module.exports = class RateLimiter {
17
18
  if (this.count < this.max_concurrent) {
18
19
  this.count++
19
20
  func(...args)
20
- } else {
21
+ } else if (!this.abandon_tx) {
21
22
  setTimeout(() => {
22
23
  this.process(func, ...args)
23
24
  }, this.interval_concurrent)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.7.34",
3
+ "version": "1.7.35",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {