In nodejs, setInterval is used to request regularly, and memory will continue to rise, eventually causing the process to restart.

  node.js, question

Code

var Sequelize = require('sequelize');
var sequelize = new Sequelize('mysql://XXX');
var request = require('request');

var id = 1;
var r = null;

var User = sequelize.define('user', {
  info: {
    type: Sequelize.TEXT,
  },
  uuid: {
    type: Sequelize.UUID,
    defaultValue: Sequelize.UUIDV4
  }
}, {
  freezeTableName: true // Model tableName will be the same as the model name
});

setInterval(function () {
  r = request.get('http://www.mysite.com?mid=' 加 (id加加), function(err, data) {

    if (data && data.body) {
      User.create({
        info: data.body
      }).then(function() {
        console.log(id 加 'ok');
      });
    }

  });
}, 500);

Memory

clipboard.png

Did you write something wrong that caused the resources not to be released?

This is also my problem. setInterval’s constant execution of the request data has resulted in memory explosion.