MarkLogic version : 9.0-6.2
We have a custom REST API that reads document from STAGING, then updates a few documents in FINAL, then runs an xdmp.documentRemoveCollections on the STAGING document.
Step 1: Start from STAGING DB. Read the document
Step 2: Switch to FINAL DB, apply the changes to multiple documents in FINAL DB
Step 3: Switch to STAGING DB, apply xdmp.documentRemoveCollections on the document read in step 1
We are using xdmp.eval to switch between databases, but noticed that the service is timing out, probably because of switching between the databases. (for example, if we remove xdmp.documentRemoveCollections step, then the service does not timeout, probably because it does not have to switch from FINAL to STAGING)
We tried using harmonization flow, but the behavior was not consistent, probably because of multiple document updates in FINAL.
Please suggest if there are any precautions to be followed in CUSTOM REST API to avoid time-out, while switching between databases back-and-forth.
Thanks in advance!