长期运行间隔天青与Node.js的 [英] Long-running intervals in Azure with Node.js

查看:125
本文介绍了长期运行间隔天青与Node.js的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行在Azure中的网站上的Node.js应用程序,我试图让一个计时器无限期地熄灭每隔30秒。我同时使用的setInterval和节点的cron 但是这两种停止约半小时后,工作试过。有在日志中没有错误,并且该网站熬夜,但计时器停止射击。我可以开始或重新再定时器,但它只是停止后,另一半小时的工作。

I'm running a Node.js app in an Azure website and I'm trying to get a timer to go off every 30 seconds indefinitely. I've tried using both setInterval and node-cron but both of these stop working after about half an hour. There are no errors in the logs, and the site stays up, but the timer stops firing. I can start or recreate the timer again but it just stops working after another half an hour.

我在免费试用期,我正在运行到某种这里帐户限制的?还是有我应该这样做一些其他的方式,或某种方式制定出什么让计时器停止?

I am on the free trial period, am I running into some sort of account restriction here? Or is there some other way I should be doing this or some way to work out what is making the timer stop?

推荐答案

在一个网站上托管的Node.js(或实际上使用云服务的Node.js的PowerShell的支持)的节点过程是通过的 IISNode

When hosting Node.js on a website (or in fact using the node.js powershell support for Cloud Services) your node process is hosted by IISNode.

IISNode将管理节点流程的生命周期。我猜它有意关闭你失望的30分钟后。

IISNode will manage the lifecycle of the node process. I'm guessing it's intentionally shutting you down after 30 minutes.

您需要运行,如果你想那将熬夜一个流程节点自己在Azure上。有两个选项:

You need to run node yourself in Azure if you want a process that's going to stay up. There are two options:


  1. 使用虚拟机(目前在preVIEW),以及手动复制node.exe,而JavaScript到一个虚拟机,手动启动您的应用程序(或作为计划任务或东西)。您可以使用Windows或Linux。

  2. 使用云服务,并创建启动节点作为辅助角色启动任务。这使您能够扩展和能力。

  1. Use the Virtual Machines (currently in preview), and manually copy node.exe, and your javascript onto a virtual machine, and start your app manually (or as a scheduled task or something). You can use either Windows or Linux.
  2. Use Cloud Services, and create a Worker Role which starts node as a startup task. This gives you the ability to scale as well.

这篇关于长期运行间隔天青与Node.js的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆