I'm using a rest API with two method:
- The first one start a job and it return the job id (RunJob).
-
The second one get me the job termination stats:(GetJobStat
This is the code that I'm using :
var id = RunJob(); Console.WriteLine(string.Format("id {0}",id)); do { Thread.Sleep(100); } while (GetJobStat(id)); Console.ReadLine();
My question is there any better ways to manager my GetJobStat call than using do while with sleep, I'm searching for a design pattern to optimize my code.
Aucun commentaire:
Enregistrer un commentaire