diff options
author | Damien F. Katz <damien@apache.org> | 2009-01-23 04:15:47 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2009-01-23 04:15:47 +0000 |
commit | 5dd96d8ee5f89524fa0be0f087a21f81b6b68ec4 (patch) | |
tree | c4931d99e50a77aebe695279bc8567e1eee7499c /src/couchdb/couch_httpd_misc_handlers.erl | |
parent | 0a46c330072a3811d98a5c989d4c6486cff83df2 (diff) |
Added task status checking, to help debug the progress of long running tasks, like view indexing and compaction.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@736906 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_misc_handlers.erl')
-rw-r--r-- | src/couchdb/couch_httpd_misc_handlers.erl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl index 31e821ce..e30f7594 100644 --- a/src/couchdb/couch_httpd_misc_handlers.erl +++ b/src/couchdb/couch_httpd_misc_handlers.erl @@ -14,7 +14,8 @@ -export([handle_welcome_req/2,handle_favicon_req/2,handle_utils_dir_req/2, handle_all_dbs_req/1,handle_replicate_req/1,handle_restart_req/1, - handle_uuids_req/1,handle_config_req/1,handle_stats_req/1]). + handle_uuids_req/1,handle_config_req/1,handle_stats_req/1, + handle_task_status_req/1]). -export([increment_update_seq_req/2]). @@ -61,12 +62,22 @@ handle_all_dbs_req(#httpd{method='GET'}=Req) -> handle_all_dbs_req(Req) -> send_method_not_allowed(Req, "GET,HEAD"). + handle_stats_req(#httpd{method='GET'}=Req) -> ok = couch_httpd:verify_is_server_admin(Req), send_json(Req, {couch_server:get_stats() ++ couch_file_stats:get_stats()}); handle_stats_req(Req) -> send_method_not_allowed(Req, "GET,HEAD"). + +handle_task_status_req(#httpd{method='GET'}=Req) -> + ok = couch_httpd:verify_is_server_admin(Req), + % convert the list of prop lists to a list of json objects + send_json(Req, [{Props} || Props <- couch_task_status:all()]); +handle_task_status_req(Req) -> + send_method_not_allowed(Req, "GET,HEAD"). + + handle_replicate_req(#httpd{user_ctx=UserCtx,method='POST'}=Req) -> {Props} = couch_httpd:json_body(Req), Source = proplists:get_value(<<"source">>, Props), |