Skip to content

Commit

Permalink
CommandInModel增加StartTime,指定命令开始执行的未来时间
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Sep 23, 2024
1 parent a280c81 commit 2c59777
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion NewLife.Remoting.Extensions/WebHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private static Uri GetRawUrl(Uri uri, Func<String, String> headers)
if (port > 0 && port != 80 && port != 443)
{
uriInfo.Port = port;
uri = new Uri(uriInfo.ToString());
uri = new Uri(uriInfo.ToString()!);
}

return uri;
Expand Down
2 changes: 1 addition & 1 deletion NewLife.Remoting/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected virtual ICluster<String, ISocketClient> InitCluster()
}
finally
{
Cluster.Put(client);
Cluster.Return(client);
}
}

Expand Down
6 changes: 3 additions & 3 deletions NewLife.Remoting/ClientPoolCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public class ClientPoolCluster<T> : ICluster<String, T> where T : class

/// <summary>归还</summary>
/// <param name="value"></param>
public virtual Boolean Put(T value)
public virtual Boolean Return(T value)
{
if (value == null) return false;

return Pool.Put(value);
return Pool.Return(value);
}

/// <summary>Round-Robin 负载均衡</summary>
Expand Down Expand Up @@ -101,7 +101,7 @@ public MyPool(ClientPoolCluster<T> cluster)

/// <summary>释放时,返回是否有效。无效对象将会被抛弃</summary>
/// <param name="value"></param>
protected override Boolean OnPut(T value) => value != null && (value is not IDisposable2 ds || !ds.Disposed);
protected override Boolean OnReturn(T value) => value != null && (value is not IDisposable2 ds || !ds.Disposed);
}

#region 日志
Expand Down
2 changes: 1 addition & 1 deletion NewLife.Remoting/ClientSingleCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public virtual T Get()

/// <summary>归还</summary>
/// <param name="value"></param>
public virtual Boolean Put(T value) => true;
public virtual Boolean Return(T value) => true;

/// <summary>Round-Robin 负载均衡</summary>
private Int32 _index = -1;
Expand Down
6 changes: 3 additions & 3 deletions NewLife.Remoting/ICluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface ICluster<TKey, TValue>

/// <summary>归还</summary>
/// <param name="value"></param>
Boolean Put(TValue value);
Boolean Return(TValue value);
}

/// <summary>集群助手</summary>
Expand All @@ -47,7 +47,7 @@ public static TResult Invoke<TKey, TValue, TResult>(this ICluster<TKey, TValue>
}
finally
{
cluster.Put(item);
cluster.Return(item);
}
}

Expand All @@ -67,7 +67,7 @@ public static async Task<TResult> InvokeAsync<TKey, TValue, TResult>(this IClust
}
finally
{
cluster.Put(item);
cluster.Return(item);
}
}
}
3 changes: 3 additions & 0 deletions NewLife.Remoting/Models/CommandInModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public class CommandInModel
/// <summary>参数</summary>
public String? Argument { get; set; }

/// <summary>开始时间。多久之后开始执行,单位秒</summary>
public Int32 StartTime { get; set; }

/// <summary>有效期。多久之后指令过期,单位秒,未指定时表示不限制</summary>
public Int32 Expire { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion NewLife.Remoting/NewLife.Remoting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NewLife.Core" Version="11.0.2024.913-beta0901" />
<PackageReference Include="NewLife.Core" Version="11.0.2024.923-beta0014" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion NewLife.Remoting/WsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected virtual ICluster<String, WebSocket> InitCluster()
}
finally
{
Cluster.Put(client);
Cluster.Return(client);
}
}

Expand Down
1 change: 1 addition & 0 deletions Samples/IoTZero/IoTZero.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<PackageReference Include="NewLife.MQTT" Version="2.0.2024.708" />
<PackageReference Include="NewLife.Redis" Version="5.7.2024.801" />
<PackageReference Include="NewLife.Stardust.Extensions" Version="3.0.2024.902" />
<PackageReference Include="NewLife.XCode" Version="11.16.2024.917-beta0218" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Samples/Zero.RpcServer/Zero.RpcServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ItemGroup>
<PackageReference Include="NewLife.Redis" Version="5.7.2024.801" />
<PackageReference Include="NewLife.Stardust" Version="3.0.2024.902" />
<PackageReference Include="NewLife.XCode" Version="11.15.2024.902" />
<PackageReference Include="NewLife.XCode" Version="11.16.2024.917-beta0218" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions Samples/ZeroServer/ZeroServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<PackageReference Include="NewLife.Cube.Core" Version="6.1.2024.902" />
<PackageReference Include="NewLife.Redis" Version="5.7.2024.801" />
<PackageReference Include="NewLife.Stardust.Extensions" Version="3.0.2024.902" />
<PackageReference Include="NewLife.XCode" Version="11.16.2024.917-beta0218" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NewLife.Core" Version="11.0.2024.913-beta0901" />
<PackageReference Include="NewLife.Core" Version="11.0.2024.923-beta0014" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions XUnitTest/JsonEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void EncodeRequest()
var len = reader.ReadInt32();
Assert.Equal(value.Total, len);
var buf = reader.ReadBytes(len);
Assert.Equal(value.ToHex(64), buf.ToHex(64));
Assert.Equal(value.ToHex(64), buf.ToHex(null, 0, 64));
}
}

Expand Down Expand Up @@ -129,7 +129,7 @@ public void EncodeResponse()
Assert.Equal(value.ToArray(), span);

var hex1 = value.ToHex(64);
var hex2 = span.ToHex(64);
var hex2 = span.ToHex();
Assert.Equal(hex1, hex2);
//Assert.Equal(value.Count, (Int32)pk.Slice(1 + name.Length, 4).ReadUInt32());
//Assert.Equal(value.ToHex(), pk.Slice(1 + name.Length + 4, value.Count).ToHex());
Expand Down
2 changes: 1 addition & 1 deletion XUnitTest/XUnitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="NewLife.Core" Version="11.0.2024.913-beta0901" />
<PackageReference Include="NewLife.Core" Version="11.0.2024.923-beta0014" />
<PackageReference Include="NewLife.UnitTest" Version="1.0.2023.1204" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down

0 comments on commit 2c59777

Please sign in to comment.