Skip to content

Commit 8095a56

Browse files
committed
Fix task scheduling
1 parent db19732 commit 8095a56

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

AzLink/AzLink.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ namespace Oxide.Plugins;
1111
[Description("Link your Azuriom website with an Oxide server.")]
1212
class AzLink : CovalencePlugin
1313
{
14-
private const string AzLinkVersion = "0.1.0";
14+
private const string AzLinkVersion = "0.1.1";
1515

16-
private DateTime lastSent = DateTime.MinValue;
17-
private DateTime lastFullSent = DateTime.MinValue;
16+
private DateTime lastSent = DateTime.Now;
17+
private DateTime lastFullSent = DateTime.Now;
1818

1919
private void Init()
2020
{
@@ -92,22 +92,22 @@ private void TryFetch()
9292
return;
9393
}
9494

95-
if ((now - lastSent).Seconds < 15)
95+
if ((now - lastSent).TotalSeconds < 15)
9696
{
9797
return;
9898
}
9999

100100
lastSent = now;
101101

102-
var sendFull = now.Minute % 15 == 0 && (now - lastFullSent).Seconds > 60;
102+
var full = now.Minute % 15 == 0 && (now - lastFullSent).TotalSeconds >= 60;
103103

104-
if (sendFull)
104+
if (full)
105105
{
106106
lastFullSent = now;
107107
}
108108

109109
RunFetch(res => DispatchCommands(res.Commands),
110-
code => LogError("Unable to send data to the website (code {0})", code), sendFull);
110+
code => LogError("Unable to send data to the website (code {0})", code), full);
111111
}
112112

113113
private void RunFetch(Action<FetchResponse> callback, Action<int> errorHandler, bool sendFullData)

0 commit comments

Comments
 (0)