Created
September 4, 2019 09:34
-
-
Save tobbbe/841b193fced11975c8a8d09b8077f27c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Import | |
{ | |
private static object ImportLock = new object(); | |
private static DateTime LastImport = DateTime.MinValue; | |
public static ImportInfo Import() | |
{ | |
lock (ImportLock) | |
{ | |
if (DateTime.Now.AddSeconds(-10) < LastImport) | |
{ | |
return "no import - time lock"; | |
} | |
LastImport = DateTime.Now; | |
return "imported"; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment