- Bot now takes shard id (optional) and total shards (optional) command line arguments (changed from shard id and parent process id)

- Sharding with coordinator now works properly
- Documented creds.yml RestartCommand - it has no effect when coordinator is starting the bot
- Regenerated creds_example.yml
- Removed all db migrators as the v3 requires the user to have updated 2.x all the way
- TotalShards in creds.yml gets overriden by coord.yml's TotalShards if the bot is ran through coordinator (more precisely, by the command line argument to the bot)
- Coordinator now runs on http://localhost:3442 by default, you can change this in appsettings.json
    - This is done because of macos https issues
    - Primarily because https for regular users is a massive hassle. Coordinator shouldn't be exposed anyway
- Minor cleanup
This commit is contained in:
Kwoth
2021-06-25 19:14:34 +02:00
parent a1ef862382
commit 670b0aca96
14 changed files with 119 additions and 398 deletions

View File

@@ -52,12 +52,12 @@ namespace NadekoBot
public event Func<GuildConfig, Task> JoinedGuild = delegate { return Task.CompletedTask; };
private readonly BotCredsProvider _credsProvider;
public Bot(int shardId)
public Bot(int shardId, int? totalShards)
{
if (shardId < 0)
throw new ArgumentOutOfRangeException(nameof(shardId));
_credsProvider = new BotCredsProvider();
_credsProvider = new BotCredsProvider(totalShards);
_creds = _credsProvider.GetCreds();
_db = new DbService(_creds);
@@ -171,7 +171,6 @@ namespace NadekoBot
Log.Information($"All services loaded in {sw.Elapsed.TotalSeconds:F2}s");
}
// todo remove config migrations
private void ApplyConfigMigrations()
{
// execute all migrators
@@ -180,13 +179,6 @@ namespace NadekoBot
{
migrator.EnsureMigrated();
}
// and then drop the bot config table
// var conn = _db.GetDbContext()._context.Database.GetDbConnection();
// using var deleteBotConfig = conn.CreateCommand();
// deleteBotConfig.CommandText = "DROP TABLE IF EXISTS BotConfig;";
// deleteBotConfig.ExecuteNonQuery();
}
// todo isn't there a built in for loading type readers?