Base solution for your next web application
Open Closed

API Request Timeout Durations- Longer Timeout per method/request specific #8966


User avatar
0
AuroraBMS created

Good day,

I am currently struggling a bit with timeout on the Mobile to API request. I'm probably explaining this horribly but what happens in short is that we have an integration on the API that connects to SAP Business One(ERP Package) due to the nature of this we have to check if there is a conneciton open, if it is not open we connect again. This in itself can be a lenghty process anything between 3seconds to 3-5minutes when seriously unlucky. This causes a bit of an issue as the submission of transactions can also take quite a bit of time depending on validation and amount of lines.

So when for instance during month end the company pulls reports it slow the SAP system considerably and this leads to delays in the integration.

From what I can see, the the API requests have a 30 second timeout duration, where can I change this to a longer period for the month end scenarios or high productivity times. Is there a way to allow the timeout for specific transactions like what was done with hangfire: [DisableConcurrentExecution(timeoutInSeconds: 10 * 60)]

Thank you!

Regards, Aurora-BMS


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    You can create a new unit of work and set the timeout for the transaction.

    using (var uow = UnitOfWorkManager.Begin(new UnitOfWorkOptions
    {
    	IsTransactional = true,
    	Scope = TransactionScopeOption.RequiresNew,
    	Timeout = TimeSpan.FromSeconds(10 * 60)
    }))
    {
    
    	await uow.CompleteAsync();
    }