Skip to content

Commit

Permalink
Increase max connections + join threads
Browse files Browse the repository at this point in the history
  • Loading branch information
alicealys committed Nov 8, 2023
1 parent d46246d commit fde27f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/component/mysql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,25 @@ namespace mysql
class component final : public component_interface
{
public:
void pre_destroy() override
{
for (auto i = tasks.begin(); i != tasks.end(); ++i)
{
i->second.canceled = true;
}
}

void post_unpack() override
{
scripting::on_shutdown([]()
{
for (auto i = tasks.begin(); i != tasks.end(); ++i)
{
i->second.canceled = true;
if (i->second.thread.joinable())
{
i->second.thread.join();
}
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/component/mysql.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace sql = sqlpp::mysql;

namespace mysql
{
constexpr auto max_connections = 100;
constexpr auto max_connections = 256;
constexpr auto connection_timeout = 200s;

using database_mutex_t = std::recursive_mutex;
Expand Down

0 comments on commit fde27f3

Please sign in to comment.