nickva commented on a change in pull request #2299: return indexing errors to 
request
URL: https://github.com/apache/couchdb/pull/2299#discussion_r350796546
 
 

 ##########
 File path: src/couch_views/src/couch_views_indexer.erl
 ##########
 @@ -87,7 +88,49 @@ init() ->
         design_opts => Mrst#mrst.design_opts
     },
 
-    update(Db, Mrst, State).
+    try
+        update(Db, Mrst, State)
+    catch
+        exit:normal ->
+            ok;
+        Error:Reason  ->
+            NewRetry = Retries + 1,
+            RetryLimit = retry_limit(),
+
+            if NewRetry < RetryLimit -> ok; true ->
+                    NewData = add_error(Error, Reason, Data),
+                    couch_jobs:finish(undefined, Job, NewData),
+                    exit(normal)
+            end,
+
+            DataErr = Data#{<<"retries">> := NewRetry},
+            StateErr = State#{job_data := DataErr, last_seq := <<"0">>},
 
 Review comment:
   Ah that makes sense. Good call. Maybe a comment about couch_jobs subscribe 
behavior would work there. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to