Bulk-Operations icon indicating copy to clipboard operation
Bulk-Operations copied to clipboard

Setting timeout on DeleteFromQuery

Open fayilt opened this issue 4 years ago • 4 comments

Hi, is there a way to override the default timeout of the DeleteFromQuery operation? I couldn't find anything in the documentation.

Thanks

fayilt avatar Mar 03 '21 15:03 fayilt

Hello @fayilt ,

You simply need to specify a BatchTimeout. You can verify it with the logger:

using (var bulk = new BulkOperation<EntitySimple>())
{
	bulk.Connection = connection;
	bulk.DestinationTableName = "EntitySimple";
	
	var sb = new StringBuilder();
	bulk.Log = x => sb.AppendLine(x);
	bulk.BatchTimeout = 999;
	
	bulk.DeleteFromQuery(tests => tests.Where(x => x.ColumnInt > 0));

	var s = sb.ToString();
}

Let me know if that answers correctly to your question.

Best Regards,

Jon

JonathanMagnan avatar Mar 03 '21 16:03 JonathanMagnan

Thanks, that partially answers my question. We're using DeleteFromQuery extension method on IQueryable, I assume there is no way to specify timeout when using that? And what's the default timeout in that case?

fayilt avatar Mar 03 '21 17:03 fayilt

Hello @fayilt ,

The default timeout might depend on which library you are using.

The default timeout for:

  • Bulk Operations is 15s // default timeout
  • Entity Framework Extensions (EF Core) is 15s // default timeout
  • Entity Framework Extensions (EF6) is 180s // due to backward compatibility

To set the timeout for EFE, you simply need to set a command timeout as you normally do in Entity Framework:

EFCore: ctx.Database.SetCommandTimeout(777); EF6: ctx.Database.CommandTimeout = 777;

Let me know if that answers all your questions.

Best Regards,

Jon

JonathanMagnan avatar Mar 03 '21 17:03 JonathanMagnan

Hello @fayilt ,

Since our last conversation, we haven't heard from you!

Don't hesitate to contact us if you have any questions.

Best regards,

Jon

JonathanMagnan avatar Mar 08 '21 13:03 JonathanMagnan