I have a memory leak and would like to apply a temporary patch while I debug it. I want to restart the dyno whenever a specific request from a client comes in. I'm assuming appName below is just this:
https://i.stack.imgur.com/hDpdh.png
Here is the constant/module declaration:
const requestModule = require('request');
var token = process.env.HEROKU_API_TOKEN;
var appName = 'app-name';
I'd like to restart the dyno inside a POST request I've made using this code:
requestModule.delete(
{
url: 'https://api.heroku.com/apps/' + appName + '/dynos/',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/vnd.heroku+json; version=3',
'Authorization': 'Bearer ' + token
}
},
function(error, response, body) {
// Do stuff
console.log("ran the restart")
}
);
'ran the restart' prints to the Heroku logs but the dyno doesn't seem to actually restart (I assumed I would see it restarting in the logs as well, and there's no output). I need to do this to temporarily fix a memory leak.