Open jamie94bc opened 8 years ago
Could use the new ?
null check keyword which will help prevent against this too. I'm trying to think of a scenario when you would ever want to delete a queue..
@niemyjski yeah I'm with you on that. I'd rather replace DeleteQueueAsync()
with ClearQueueAsync()
?
would silently fail, which wouldn't be fantastic behavior!
Is this still an issue?
Yeah - it's different from #45 (another race condition in AzureServiceBusQueue
)
It is an issue, but I don't know if it can be solved without using locks everywhere. I think the "correct" solution is to document that it's a dangerous method and shouldn't be used in multi-threaded environments. Once one part of your application determines the queue should be deleted, the rest of the application should be halted.
@moswald would you mind updating the docs for this?
As mentioned by @moswald in #38 ...
EnqueueAsync()
and Thread B callsDeleteQueueAsync()
EnsureQueueCreatedAsync()
, ensuring_queueClient
is not null_queueClient
to null_queueCleint
which is now nullThere's not really a nice way to handle this without locking. Couple of solutions:
Option 1
Wrap
_queueClient
in a property which throws a slightly different exception, leaving the user to retry.Option 2
Implement retry logic (preferably in
QueueBase
).