#Sharding in a prod bot

1 messages · Page 1 of 1 (latest)

pallid saddle
#

Is there any already implemented way to shard in twilight 0.17 or is rolling your own sharding manager the way to go?

rapid dragon
#

that example is for something else, there is no difference how you should do sharding between 0.16 and 0.17

pallid saddle
rapid dragon
#

I just run each shard seperately with a small bit of shared state, I have not really had a need for a manager.

pallid saddle
rapid dragon
#

Disconnects are handled internally in the shard, and generally crashes should be avoided

dapper elm
#

You can observe tokio task panics with JoinSet and track tasks through task::Id

#

Each shard should be in their own task for optimal performance fyi. How was your shardmanager setup? Channels?

pallid saddle
#

But a JoinSet is probably better in this case (and in all cases)

dapper elm
#

Have you run into shard crashes? The shard task should be very small, essentially just a next-spawn loop. I mean there's not much that can panic there

#

Otherwise I'd use mpsc channels for state management. It fits in really nice since the shard is cancellation safe

pallid saddle
dapper elm
#

We've had some bugs in the past with shards getting stuck

#

We've never had panics though

#

But let us know if you run into it again, irregardless of the shard count