Skip to content

v1.2.0

Choose a tag to compare

@RagnarLothbrok-Odin RagnarLothbrok-Odin released this 22 May 14:30
· 49 commits to main since this release

Full Changelog: v1.1.8...v1.2.0

馃殌 Sharding Support Release

Overview

This release introduces sharding support to ValkyrieCore, enabling better scalability and performance for larger bots. The bot now uses discord-hybrid-sharding to distribute load across multiple processes while maintaining efficient resource usage.

馃幆 Changes

Added

  • Sharding Support: Integrated discord-hybrid-sharding for efficient bot scaling
  • Cluster Management: Added cluster manager to handle shard distribution
  • Automatic Shard Calculation: Bot now automatically calculates required shards based on server count
  • Worker Mode: Implemented worker-based sharding for better performance

Modified

  • Client Configuration: Updated Discord.js client to support sharding
  • Process Management: Improved process handling with cluster-based architecture

鈿欙笍 Technical Details

  • Each cluster handles 2 shards by default
  • Uses worker threads for better performance
  • Automatic shard calculation (1 shard per 2500 servers)
  • Automatic cluster calculation based on shard count

馃摑 Notes

  • No breaking changes to existing bot functionality
  • Command handling remains the same from a user perspective
  • Improved performance for bots with many servers
  • Better resource utilization across CPU cores

馃敡 Configuration

The sharding is configured automatically, but you can adjust shardsPerClusters in Cluster.ts if needed:

const manager = new ClusterManager(`${dir}/Main.ts`, {
    totalShards: 'auto',  // Automatically calculated
    totalClusters: 'auto', // Automatically calculated
    shardsPerClusters: 2,  // Adjustable based on needs
    mode: 'worker',
    token: process.env.BOT_TOKEN,
});

馃摎 Documentation

For more information about sharding in ValkyrieCore, check the updated documentation in the code comments.