I'm using azure function apps(Queue trigger) to run the hourly jobs. I'm generating a job for each tenant and pushing it to the Queue => which triggers the function app.
For each job(class with some logic) I'm passing APIservice.
APIservice is an instance of HttpClient with baseuri and tenant code will be stored in header.As can be seen below
Lets say if I have 5 tenants , 5 jobs are triggered at once and are executed in parallel. But some times (not always) I'm facing this error.
An item with the same key has already been added. Key: System.Net.Http.Headers.HeaderDescriptor
I expected each instance to be independently initialized , but sometimes it is giving this error. How do we avoid it ?