cancel
Showing results for 
Search instead for 
Did you mean: 

uSleep function is not stable

Chenyang
Contributor
0 Kudos

Hi Experts,

I used uSleep function in termination case. The system waits for 5 minutes to complete some other activities, before it terminates the user.

The function works fine in most case. But when there were any issue with the dispatcher, the uSleep sleeps forever and will never wake up again. Dispatcher restart will not resolve issue, unless you restart the the task by force.

Is there any way to avoid the uSleep issue?

Thanks,

Chenyang

former_member2987
Active Contributor
0 Kudos

Hi Chenyang,

First off, I think you need to open a ticket on that. While the dispatcher kicks off the job, the JavaScript library should not be affected. I would think that if the dispatcher was interrupting the pass execution that re running it should fix it.

As a workaround to uSleep, could you do a uProvision on a task that had a 5 minute delay before start, just load the task with a pass that does nothing. (or very little). Or if you can break up the actions in the task so that you do some, and then stick in the 5 minute delay before the remaining operations occur.

Matt

Chenyang
Contributor

Hi Matt,

thanks for your suggestion. I have an action task before the termination task doing nothing but to sleep 5 minutes. Since it is a sporadic issue. I will report to SAP if it happens again .

Thanks,

Chenyang

former_member2987
Active Contributor
0 Kudos

Hey that's great Chenyang! Please like the answer and accept if it helped!

Matt

View Entire Topic
brandonbollin
Active Participant

Couldn't you just use a Wait Task? Both IDM v7.2 and v8 have something along these lines. I would assume the task you're speaking about is tied into the Modify Task for the MX_FS_EMPLOYMENT_STATUS or MX_FS_EMPLOYMENT_STATUS_ID attributes. If the attribute is modified, you evaluate the new value in your task and, if the identity is now terminated, you perform your termination process.

During the termination process, you're probably calling another, external process that has to complete its actions before the remaining operations in your main task complete. Immediately after the task that has the uProvision in the script or is linked to that external task, in IDM v7.2, insert an ordered task group and in the Result Handling tab, select the box at the top, "Wait for Event Tasks". In IDM v8, there's a specific, "Wait Task" you can insert into the workflow chart (the new thing in Eclipse that looks like a Visio diagram). Both of these will accomplish the same thing, await for all tasks associated with this AuditID to complete before moving on to the next item on your main event task workflow.

This is much more reliable than using the uSleep function because it's not time sensitive. What happens on a especially heavy processing day when IDM is churning through a TON of data and that sub process takes longer than 5 minutes to complete? Might happen only once in a blue moon but do you really want your process to have that kind of vulnerability? Using a wait task is much cleaner and will work right every time. Heck, might even be faster because, likely, in most situations, your sub task won't take 5 minutes to finish so now your main process can move forward more quickly.

Chenyang
Contributor

Hi Brandon,

I like your idea. I will test your solution with wait task.

cheers

Chenyang

brandonbollin
Active Participant
0 Kudos

Cool! Let me know if it works for you. I'll keep watching this thread for your results. 🙂

Chenyang
Contributor
0 Kudos

Hi Brandon,

Sorry for slow response. I tested the "wait solution"solution and it didn't work unfortunately.

The "Wait task" does not actually wait for other activities of the same identity to complete before moving on to the next one - terminate the user. The termination happens to the user first, then some other updates continue to the identity which cause inconsistency.

I have a sync job to read and update employee profiles from SuccessFactors to IdM. There are many attributes to calculate and update, so it is quite time consuming. There is another event based task "termination" which is set on the create/update event of mx_fs_employment_status_id.

I want the user update to complete first, before it triggers the termination event. The "wait task" does not wait for the user update job, which is outside of the termination task.

Can you share some other ideas on the issue I am facing?

Thanks,

Chenyang

brandonbollin
Active Participant

Maybe your best bet would be to have two separate reads of attribute updates from SuccessFactors. Have your current sync job operate as normal and read in all the employee profile updates but disable the update to MX_FS_EMPLOYMENT_STATUS_ID. Then, once that task has completed and updated all the attributes in IDM, have a second task that does the same read from SuccessFactors but only updates the MX_FS_EMPLOYMENT_STATUS_ID attributes on your user records. Now, when anyone's records gets a terminated status, then your termination process begins. Perhaps that would work?