Skip to content

Commit effed12

Browse files
committed
Restart mnesia if wait_for_tables hangs
1 parent b129abc commit effed12

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/mongoose_internal_databases.erl

+8-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@ wait_for_tables_loop(Tables, Interval, Total) ->
4646
ok;
4747
{timeout, Tables} ->
4848
%% If the tables don't change, mnesia is most likely stuck
49-
error(#{what => mnesia_wait_for_tables_timeout,
50-
waiting_for_tables => Tables,
51-
waiting_time => Total + Interval});
49+
?LOG_WARNING(#{what => mnesia_wait_for_tables_timeout,
50+
waiting_for_tables => Tables,
51+
waiting_time => Total + Interval}),
52+
mnesia:stop(),
53+
application:start(mnesia, permanent);
54+
%% error(#{what => mnesia_wait_for_tables_timeout,
55+
%% waiting_for_tables => Tables,
56+
%% waiting_time => Total + Interval});
5257
{timeout, NewTables} ->
5358
?LOG_WARNING(#{what => mnesia_wait_for_tables_progress,
5459
waiting_for_tables => NewTables,

0 commit comments

Comments
 (0)