How to Pause Without Blocking Job Queue in One Identity Manager Scripts?

I’m developing scripts for a customer in One Identity Manager and noticed that using Thread.Sleep tends to block the Job Queue, making the entire process slower. Since the process involves bulk operations with many items in the queue, I’m looking for a more efficient way to pause or wait without blocking other jobs. Is there a recommended approach on the Job Server, such as waiting for events or using a more efficient timer, to optimize this kind of scenario?

  • Hi Barry, Can I use it on a script?

  • No, it's a process step component.  Perhaps if you explained your full use case / issue, the forum might be able to help.

  • It is definitely a bad idea to use SLEEP or WAIT in a script as it blocks the execution slot. If you have open transactions it might even block the whole system via DB-locks.
    Generally your script should be small enough to only do "atomic" operation, i.e. do something short that either fully fails or fully succeeds (reasonably fast). 

    If you have to do a multi-step operation the recommended way is to have a multi-step process that calls multiple scripts, one per step. Something like 1. create some assignement, 2. wailt till dependent objects are assigned, 3. depending on the result send mail.
    Waiting in the process can be done with the DELAY component. In most cases I found an actual check for the blocking condition and a number or retries on the process step more suitable. 

    I had some cases where I actually had a script that did some first operation, then attempted the second operation. If that fails it throws an errors and the process does a retry on the same script. Not the first operation is already present and the second is attmpted again (after process latency and retry).

    Another option is for your script to detect the wait-conditon and instead of waiting, to fire an event/process with a delayed start-time that does the second part of the operation.

    Overall: Look at your business process and implement is as a (series) of OIM-processes. Scripts may be part of the process, but generally should only implement small operations within the process