Question
· Apr 29

WorkMgr execution issues

Hello Community,

I have a queue that I need to traverse and perform operations on. To distribute the workload across multiple processes, I used a Work Queue Manager do process and I'm not expecting any status from it So, I skipped Sync / WaitForComplete in my implementation

When I execute the below code. Lot of queues are not processed properly. If I add a 0.1-second delay, it works as expected. Is there a minimum time required for a process to start after it's added to the Queue

ClassMethod CleanUpQWrkMgr()
{
    Set QueueId=""
    Set workMgr = ##class(%SYSTEM.WorkMgr).%New()
    If workMgr="" quit
    for {
        Set QueueId = $O(^Q(QueueId),1,data),event="" q:QueueId=""
        Do workMgr.Queue("..Cleanup",QueueId)
        //h .1	
    }
    //Set st= workMgr.WaitForComplete()
}

ClassMethod Cleanup(QueueId As %Integer)
{
    Set event=""
    For {
            Set event = $Order(^Q(QueueId,event)),rev="" Q:event=""
            For {
                Set rev = $Order(^Q(QueueId,event,rev)) Q:rev=""
                If '$Data(^DQ(rev,"e",event))
                Do $I(CNT)
            }
    }
    Set ^test("CNT",QueueId)=CNT
    Quit 1
}

Thanks!

Product version: IRIS 2024.1
$ZV: IRIS for Windows (x86-64) 2024.1.1 (Build 347U) Thu Jul 18 2024 17:40:10 EDT
Discussion (2)1
Log in or sign up to continue