sharding (core): Add base sharding support.
Add `meta.args` for command line argument access. Add command line argument support for shard number. Add shard count to config file. Add `meta.sharding` exposing shard properties. Add shard number to logging methods. Add shard number to data appid.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from meta import client, conf, log
|
||||
from meta import client, conf, log, sharding
|
||||
|
||||
from data import tables
|
||||
|
||||
@@ -7,7 +7,12 @@ import core # noqa
|
||||
import modules # noqa
|
||||
|
||||
# Load and attach app specific data
|
||||
client.appdata = core.data.meta.fetch_or_create(conf.bot['data_appid'])
|
||||
if sharding.sharded:
|
||||
appname = f"{conf.bot['data_appid']}_{sharding.shard_count}_{sharding.shard_number}"
|
||||
else:
|
||||
appname = conf.bot['data_appid']
|
||||
client.appdata = core.data.meta.fetch_or_create(appname)
|
||||
|
||||
client.data = tables
|
||||
|
||||
# Initialise all modules
|
||||
|
||||
Reference in New Issue
Block a user