mardi 17 janvier 2017

Algorithm for retry process

Let say that we have a series of function that needs to execute in a loop.

  1. Get Setttings return networkPath & localPath.
  2. Copy File from networkPath(from process 1) to another localPath.
  3. Read file from localPath return list of info.
  4. Save list of info into DB.

In normal execution I have this code.

public void StartProcess() {
    var settings = GetSettings();
    CopyFiles(settings);
    var listOfData = ReadFile(settings);
    SaveListOfData(listOfData);
}

StartProcess method will be executed in a loop in which it waits for a file to read.

What would be a nice way to handle in which a program/code can retry specific process? For example there's an error on number 2 process, the program should execute process 2 and skip process 1.

Aucun commentaire:

Enregistrer un commentaire