Link to home
Start Free TrialLog in
Avatar of condor888
condor888

asked on

Azure web job singleton function is locked

I am using Azure web job to run some logic continuously.  The function is a singleton function. However, I am getting "Waiting for lock" message after I tried to run this function after a restart of the web app. Does it mean that another instance of the same function is keeping the lock? How can I resolve this?

The function:
namespace Ns 
{
    
    public class Functions
    {
        [Singleton]
        [NoAutomaticTriggerAttribute]
        public static async Task ProcessMethod()
        {
          while(true){
           //process logic here
           await Task.Delay(TimeSpan.FromSeconds(20));}
        }

    }
}

Open in new window

The main program:
namespace ns
{
   
    class Program
    {
   
        static void Main()
        {
            
            var host = new JobHost();

            host.RunAndBlock();
            
        }
    }
}

Open in new window

User generated image
ASKER CERTIFIED SOLUTION
Avatar of Zachariah Browning
Zachariah Browning
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial