Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node app hangs on request call #118

Closed
scripting opened this issue Jun 3, 2019 · 1 comment

Comments

Projects
None yet
1 participant
@scripting
Copy link
Owner

commented Jun 3, 2019

I have a Node server app that, when fielding a request, makes a request of its own to get the HTML source for the page, which it then modifies and returns as a response to the HTTP call.

I've used this technique in other apps, without issue. But this app intermittently hangs when doing this.

I can easily do a workaround, but I thought I should try to find out if anyone has ideas what could be going wrong.

Here's the code in question.

function getServerHomePage (callback) {
	var whenstart = new Date ();
	request (config.urlServerHomePageSource, function (err, response, templatetext) {
		if (err) {
			console.log ("getServerHomePage: err.message == " + err.message);
			callback (err);
			}
		else {
			console.log ("getServerHomePage: " + utils.secondsSince (whenstart) + " secs");
			var pagetable = {
				config: configToJsonText (),
				version: myVersion
				};
			var pagetext = utils.multipleReplaceAll (templatetext, pagetable, false, "[%", "%]");
			callback (undefined, pagetext);
			}
		});
	}

When it hangs this is what the console.log call shows.

getServerHomePage: 106.97 secs

The server is running on Digital Ocean, the file its accessing is on Amazon S3.

@scripting

This comment has been minimized.

Copy link
Owner Author

commented Jun 3, 2019

I went ahead and worked around the problem, reading the template from a file in the local file system.

@scripting scripting closed this Jun 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.