Hi,
I have Project Server 2007 installed.
I've created custom functionality which calls QueueUpgradeProject. One of my requirenments was to wait while this method ends. This method do not return jobUid so i was forced to implement more complicated solution to wait until task is done.
Here is code:
public static void WaitForUpgradeJob(DateTime from, DateTime to, int maxWaitTime, int minWaitTime) { var currWaitTime = 0; var end = false; // // // var q = GetClient(); do { var d = q.ReadMyJobStatus(new[] { QueueMsgType.LWPUpgradeToProject }, new[] { JobState.Sleeping, JobState.ReadyForProcessing, JobState.ReadyForLaunch, JobState.ProcessingDeferred, JobState.Processing, JobState.OnHold }, from, to, 0, true, SortColumn.CorrelationGUID, SortOrder.Ascending); if (d.Status.Count == 0) { end = true; continue; } var waitTime = minWaitTime + d.Status.Rows.Cast<DataRow>().Aggregate(0, (x, t) => x + (int)t[d.Status.WaitTimeColumn] * 1000); Thread.Sleep(waitTime); currWaitTime += waitTime; if (currWaitTime > maxWaitTime) throw new Exception("Wait time exceeded allowable limit"); } while (!end); }
maxWaitTime and minWaitTime are configuration values.
from and to values i get as follows:
var from = DateTime.Now; projectService.QueueUpgradeProject(projUid); var to = DateTime.Now.AddSeconds(1); WaitForUpgradeJob(from,to,maxWaitTime,minWaitTime);
This code worked for a long time. But last week i've encountered strange problem - after WaitForUpgradeJob method ends (no exception) i read project which was converted again and check his type to be sure that project really was converted. Last week this check started to fail - it was saying that project type is still Proposal. But in Project Server Queue i can see that all jobs finished without errors and there is no errors in ULS logs.
The strange thing that i noticed is that time when WaitForUpgradeJob ends and time in column "End time" for task for converted project with job type "Project Proposal Upgrade" are different. For example, in my application logs i can see that WaitForUpgradeJob ended at 10:05:37, in Project Server Queue i can see that job with type "Project Proposal Upgrade" for converted project ended at 10:06 (there is no seconds).
Any ideas what can be cause of this problem?
Best regards, Chernobrivets