azure-function-async

Promise is not working in azure function app javascript

假如想象 提交于 2020-03-05 04:59:45
问题 I have simple demo to understand Promise concept but it is not working as expected, see my code which i have tried. module.exports = async function (context, iotHubMessage) { context.log('START'); var promise1 = new Promise(function (resolve, reject) { setTimeout(function () { resolve('foo'); }, 1000); }); context.log(promise1); promise1.then(function (resolve) { context.log(resolve); // expected output: "foo" }); }; and I am geting this output 2019-01-24T12:58:38.695 [Information] START 2019

Are there benefits to an async function?

我的未来我决定 提交于 2019-12-23 09:32:53
问题 Azure functions allows me to write C#/F# (and more) functions which are executed given certain conditions. These functions can be async (by returning a Task). The cool thing about azure functions is that they automatically scale up depending on load. One of the cool things about the async/await pattern on a "classic" server, is that you can better utilize the cores so you can handle more requests. Since azure functions automagically scales, are there any benefits for me to write async