mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
hub_advertise_now command.
This commit is contained in:
@@ -551,3 +551,6 @@ cmd-dump_dependency_injectors-total-count = Total count: { $total }
|
||||
|
||||
cmd-dump_netserializer_type_map-desc = Dump NetSerializer's type map and serializer hash.
|
||||
cmd-dump_netserializer_type_map-help = Usage: dump_netserializer_type_map
|
||||
|
||||
cmd-hub_advertise_now-desc = Immediately advertise to the master hub server
|
||||
cmd-hub_advertise_now-help = Usage: hub_advertise_now
|
||||
|
||||
16
Robust.Server/ServerHub/AdvertiseNowCommand.cs
Normal file
16
Robust.Server/ServerHub/AdvertiseNowCommand.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Robust.Server.ServerHub;
|
||||
|
||||
internal sealed class AdvertiseNowCommand : LocalizedCommands
|
||||
{
|
||||
[Dependency] private readonly HubManager _hubManager = default!;
|
||||
|
||||
public override string Command => "hub_advertise_now";
|
||||
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
_hubManager.AdvertiseNow();
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,12 @@ internal sealed class HubManager
|
||||
_advertiseUrl = url;
|
||||
}
|
||||
|
||||
public void AdvertiseNow()
|
||||
{
|
||||
// Next heartbeat will immediately advertise to hub.
|
||||
_nextPing = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
private void UpdateInterval(int interval)
|
||||
{
|
||||
_interval = TimeSpan.FromSeconds(interval);
|
||||
|
||||
Reference in New Issue
Block a user