summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2021-02-09 23:12:56 +0000
committerGitHub <noreply@github.com>2021-02-09 23:12:56 +0000
commite089b029a754763ccec1ac889ce912627cec480a (patch)
tree99cffcdccd8df4b02698b2342e54e29789ff3dc6
parent44a13d5aeb5b1766c23f00e035915d79ab478a61 (diff)
parent776f3683205bfaa7c41b24137bfb07b7487dabe0 (diff)
downloadcouchdb-e089b029a754763ccec1ac889ce912627cec480a.tar.gz
Merge pull request #3361 from apache/active-tasks-process-status
Show process status in active_tasks
-rw-r--r--src/couch/src/couch_task_status.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/couch/src/couch_task_status.erl b/src/couch/src/couch_task_status.erl
index 4083c3f81..74247d63d 100644
--- a/src/couch/src/couch_task_status.erl
+++ b/src/couch/src/couch_task_status.erl
@@ -124,7 +124,7 @@ handle_call({add_task, TaskProps}, {From, _}, Server) ->
end;
handle_call(all, _, Server) ->
All = [
- [{pid, ?l2b(pid_to_list(Pid))} | TaskProps]
+ [{pid, ?l2b(pid_to_list(Pid))}, process_status(Pid) | TaskProps]
||
{Pid, TaskProps} <- ets:tab2list(?MODULE)
],
@@ -160,3 +160,12 @@ timestamp() ->
timestamp({Mega, Secs, _}) ->
Mega * 1000000 + Secs.
+
+
+process_status(Pid) ->
+ case process_info(Pid, status) of
+ undefined ->
+ {process_status, exiting};
+ {status, Status} ->
+ {process_status, Status}
+ end.