<commit_before>echo(off),
WorkerList =
fun(WorkName) ->
        case catch ets:tab2list(WorkName) of
            {'EXIT', _} ->
                io:format("error odbc conn not exist ~s ~n", [node()]),
                [];
            List ->
                List
        end
end,
GetDelayInfo =
fun(N) ->
        WorkerName = list_to_atom("odbc_shards_" ++ integer_to_list(N)),
        SQL = {sql_query, [<<"select 1;">>]},
        lists:filtermap(
          fun({N2, Worker})
                when is_pid(Worker)->
                  case catch sys:get_state(Worker) of
                      {'EXIT', _} ->
                          io:format("restart delayed odbc conn ~s ~p ~p ~p ~n", [node(), N , N2,  Worker ]),
                          exit(Worker, kill),
                          false;
                      State ->
                          %% # {state,<7121.9910.3894>,mysql,
                          %% #                             [<<"rds4077hl6n7cv79795i.mysql.rds.aliyuncs.com">>,
                          %% #                              3306,<<"ejabberd">>,<<"ejabberd">>,
                          %% #                              <<"ejabberd">>],
                          %% #                             30000000,1000,
                          %% #                             {0,{[],[]}}}1
                          Delay = try timer:tc(gen_fsm,sync_send_event,[Worker, {sql_cmd, SQL, os:timestamp()}, 5000]) of
                                      {Time, {selected,[<<"1">>],[[<<"1">>]]}} ->
                                          Time/1000;
                                      X ->
                                          %% io:format("error ~w~n",[X]),<commit_msg>fix bug of sys getstate<commit_after>echo(off),
WorkerList =
fun(WorkName) ->
        case catch ets:tab2list(WorkName) of
            {'EXIT', _} ->
                io:format("error odbc conn not exist ~s ~n", [node()]),
                [];
            List ->
                List
        end
end,
GetShardConfig =
fun(Num) ->
        {ok, Config} = application:get_env(message_store, odbc_shards),
        ConfigValue = proplists:get_value(Num, Config),
        Server = proplists:get_value(server, ConfigValue),
        Port = proplists:get_value(port, ConfigValue, 3306),
        {Server, Port}
end,

GetDelayInfo =
fun(N) ->
        WorkerName = list_to_atom("odbc_shards_" ++ integer_to_list(N)),
        SQL = {sql_query, [<<"select 1;">>]},
        lists:filtermap(
          fun({N2, Worker})
                when is_pid(Worker)->
                  case catch sys:get_state(Worker) of
                      {'EXIT', _} ->
                          {Server, Port} = GetShardConfig(N),
                          io:format("restart delayed odbc conn ~s ~p ~p ~p ~s ~p ~p~n", [node(), N , N2, 60001, Server, Port, Worker ]),
                          exit(Worker, kill),
                          false;
                      State ->
                          %% # {state,<7121.9910.3894>,mysql,
                          %% #                             [<<"rds4077hl6n7cv79795i.mysql.rds.aliyuncs.com">>,
                          %% #                              3306,<<"ejabberd">>,<<"ejabberd">>,
                          %% #                              <<"ejabberd">>],
                          %% #                             30000000,1000,
                          %% #                             {0,{[],[]}}}1
                          Delay = try timer:tc(gen_fsm,sync_send_event,[Worker, {sql_cmd, SQL, os:timestamp()}, 5000]) of
                                      {Time, {selected,[<<"1">>],[[<<"1">>]]}} ->
                                          Time/1000;
                                      X ->
                                          %% io:format("error ~w~n",[X]),
{'fraction_non_alphanumeric': 0.14495798319327732, 'fraction_numerical': 0.03125, 'mean_word_length': 1.0282215122470713, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3366676', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1043, 'n_words': 182}