]> git.puffer.fish Git - matthieu/nova.git/commitdiff
fix shard config
authorMatthieu <matthieu@developershouse.xyz>
Wed, 20 Oct 2021 07:45:30 +0000 (11:45 +0400)
committerMatthieu <matthieu@developershouse.xyz>
Wed, 20 Oct 2021 07:45:30 +0000 (11:45 +0400)
config/default.json
gateway/src/shard/actions.rs
gateway/src/shard/mod.rs

index 51a872927248097428c09c0f8ae73aed395dcf72..3aa90cb5cdc0c019266fb2a7d009631c12af4802 100644 (file)
@@ -28,5 +28,8 @@
             "public_key": "",
             "client_id": 123
         }
+    },
+    "gateway": {
+
     }
 }
\ No newline at end of file
index b6ef03826bf5decb68b8c29c511d9cebebb873d6..39a7ca2e4fcc615dfd3fcd6bea2bae6f8cf58b7f 100644 (file)
@@ -57,6 +57,10 @@ impl Shard {
             .await
         } else {
             info!("Sending login");
+            let mut shards: Option<[u64; 2]> = None;
+            if let Some(sharding) = self.config.shard.as_ref() {
+                shards = Some([sharding.current_shard, sharding.total_shards]);
+            }
             self._send(BaseMessage {
                 t: None,
                 sequence: None,
@@ -69,7 +73,7 @@ impl Shard {
                         browser: "Nova".to_string(),
                         device: "Nova".to_string(),
                     },
-                    shard: Some([0, 2]),
+                    shard: shards,
                     compress: Some(false),
                     large_threshold: Some(500),
                     presence: None,
index b458451c1bfcb1af6075f4d03ee35ae0147a950e..55828d0b0a9cfdae7003c0e045e762c9bf7a3597 100644 (file)
@@ -8,11 +8,10 @@ mod state;
 
 #[derive(Debug, Deserialize, Serialize, Default, Clone)]
 pub struct Sharding {
-    pub total_shards: i64,
-    pub current_shard: i64
+    pub total_shards: u64,
+    pub current_shard: u64
 }
 
-
 #[derive(Debug, Deserialize, Serialize, Default, Clone)]
 pub struct ShardConfig {
     pub max_reconnects: usize,