Skip to content

Instantly share code, notes, and snippets.

@shibayan
Created March 19, 2019 21:37
Show Gist options
  • Select an option

  • Save shibayan/8be1e4b848bdebcc4fa13a2ca01ac7d3 to your computer and use it in GitHub Desktop.

Select an option

Save shibayan/8be1e4b848bdebcc4fa13a2ca01ac7d3 to your computer and use it in GitHub Desktop.
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace FunctionApp15
{
public static class Function2
{
[FunctionName("Function2")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
CancellationToken cancellationToken,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processing a request.");
log.LogInformation($"CancellationToken is {cancellationToken.CanBeCanceled}");
try
{
await Task.Delay(TimeSpan.FromSeconds(60), cancellationToken);
}
catch (OperationCanceledException)
{
log.LogError("Cancelled");
}
log.LogInformation("C# HTTP trigger function processed a request.");
return new OkResult();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment