finalize in destructor

This commit is contained in:
Nikita Mikhaylov 2021-09-03 14:20:34 +00:00
parent b867eabe73
commit 26ab6ebc0a
3 changed files with 10 additions and 13 deletions

View File

@ -21,15 +21,9 @@ public:
buffer.assign(capacity, {}); buffer.assign(capacity, {});
} }
size_t size() const size_t size() const { return count; }
{
return count;
}
bool empty() const bool empty() const { return count == 0; }
{
return count == 0;
}
bool tryPush(T element) bool tryPush(T element)
{ {

View File

@ -111,8 +111,6 @@ void BackgroundJobAssignee::finish()
getContext()->getFetchesExecutor()->removeTasksCorrespondingToStorage(storage_id); getContext()->getFetchesExecutor()->removeTasksCorrespondingToStorage(storage_id);
getContext()->getMergeMutateExecutor()->removeTasksCorrespondingToStorage(storage_id); getContext()->getMergeMutateExecutor()->removeTasksCorrespondingToStorage(storage_id);
} }
finished = true;
} }
@ -141,7 +139,14 @@ catch (...) /// Catch any exception to avoid thread termination.
BackgroundJobAssignee::~BackgroundJobAssignee() BackgroundJobAssignee::~BackgroundJobAssignee()
{ {
assert(finished); try
{
finish();
}
catch (...)
{
tryLogCurrentException(__PRETTY_FUNCTION__);
}
} }
} }

View File

@ -48,8 +48,6 @@ private:
/// Mutex for thread safety /// Mutex for thread safety
std::mutex holder_mutex; std::mutex holder_mutex;
bool finished{false};
public: public:
enum class Type enum class Type
{ {