Don R Green 15.Jun.07 11:02 AM a Web browser General6.0.2 CF2Windows 2000
I ran across a thread covering topics on how to modify an agent to run faster. One post discussed the use of Delete in a loop as listed below.
Dim session As New NotesSession
Dim coll As NotesDocumentCollection
Dim db As NotesDatabase
Dim docCur As NotesDocument, docNext As NotesDocument
Set db = session.CurrentDatabase
Set coll = db.UnprocessedDocuments
Set docCur = coll.GetFirstDocument
Do Until docCur Is Nothing
Call session.UpdateProcessedDoc(docCur)
Set docNext = coll.GetNextDocument(docCur)
' INSERT CODE HERE TO PROCESS A SINGLE DOCUMENT
Delete docCur ' so documents don't accumulate in cache
Set docCur = docNext
Loop
I’d like to know why the need for an additional NotesDocument: docNext? Wouldn’t docNext need to be deleted too? Would it not be the same if the agent was as the following?
Do Until docCur Is Nothing
Call session.UpdateProcessedDoc(docCur)
' INSERT CODE HERE TO PROCESS A SINGLE DOCUMENT
Delete docCur ' so documents don't accumulate in cache
Set docCur = coll.GetNextDocument(docCur)
Loop