with some help I added the cursor query code to the put data in db background task and refactored that task to divide the adding of content from querying for a cursor