Merge branch 'SpoticordMusic:dev' into dev

main
Tyrone Faulhaber 2023-09-25 17:26:35 +02:00 committed by GitHub
commit 1d413aff89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 83 additions and 58 deletions

View File

@ -1,3 +1,44 @@
# Changelog # Changelog
## Current dev branch
In this section of the change log all current changes that have been made since the last version will be documented. This list will grow as more changes are made, until the next release. Upon the next release the list will be cleared.
### Changes
* Removed OpenSSL dependency
* Added aarch64 support
* Added cross compilation to Github Actions
* Added `dev` branch to Github Actions
## 2.1.1 | September 23rd 2023
Reduced the amount of CPU that the bot uses from ~15%-25% per user to 1%-2% per user (percentage per core, benched on an AMD Ryzen 9 5950X).
### Changes
* Fixed issue #20
**Full Changelog**: https://github.com/SpoticordMusic/spoticord/compare/v.2.1.0...v2.1.1
## 2.1.0 | September 20th 2023
So, it's been a while since I worked on this project, and some bugs have since been discovered.
The main focus for this version is to stop using multiple processes for every player, and instead do everything in threads.
### Changes
- Remove metrics, as I wasn't using this feature anyways
- Bring back KV for storing total/active sessions, as prometheus is no longer being used
- Allocate new players in-memory, instead of using subprocesses
- Fix issue #17
- Fix some issues with the auto-disconnect
- Removed the automatic device switching on bot join, which was causing some people to not be able to use the bot
- Force communication through the closest Spotify AP, reducing latency
- Potential jitter reduction
- Enable autoplay
- After skipping a song, you will no longer hear a tiny bit of the previous song after the silence
**Full Changelog**: https://github.com/SpoticordMusic/spoticord/compare/v2.0.0...v.2.1.0
### Issues
- Currently, the CPU usage is much higher than it used to be. I really wanted to push this update out before taking the time to do some optimizations, as the bot and server are still easily able to hold up the limited amount of Spoticord users (and v2.0.0 was just falling apart). Issue is being tracked in #20
## 2.0.0 | June 8th 2023 ## 2.0.0 | June 8th 2023
- Initial Release - Initial Release

View File

@ -54,15 +54,14 @@ impl EventHandler for Handler {
// INTERACTION_CREATE event, emitted when the bot receives an interaction (slash command, button, etc.) // INTERACTION_CREATE event, emitted when the bot receives an interaction (slash command, button, etc.)
async fn interaction_create(&self, ctx: Context, interaction: Interaction) { async fn interaction_create(&self, ctx: Context, interaction: Interaction) {
match interaction { match interaction {
Interaction::ApplicationCommand(command) => self.handle_command(ctx, command).await, Interaction::ApplicationCommand(command) => handle_command(ctx, command).await,
Interaction::MessageComponent(component) => self.handle_component(ctx, component).await, Interaction::MessageComponent(component) => handle_component(ctx, component).await,
_ => {} _ => {}
} }
} }
} }
impl Handler { async fn handle_command(ctx: Context, command: ApplicationCommandInteraction) {
async fn handle_command(&self, ctx: Context, command: ApplicationCommandInteraction) {
enforce_guild!(command); enforce_guild!(command);
// Commands must only be executed inside of guilds // Commands must only be executed inside of guilds
@ -99,7 +98,7 @@ impl Handler {
command_manager.execute_command(&ctx, command).await; command_manager.execute_command(&ctx, command).await;
} }
async fn handle_component(&self, ctx: Context, component: MessageComponentInteraction) { async fn handle_component(ctx: Context, component: MessageComponentInteraction) {
enforce_guild!(component); enforce_guild!(component);
// Components can only be interacted with inside of guilds // Components can only be interacted with inside of guilds
@ -135,4 +134,3 @@ impl Handler {
command_manager.execute_component(&ctx, component).await; command_manager.execute_component(&ctx, component).await;
} }
}

View File

@ -85,9 +85,6 @@ async fn main() {
let shard_manager = client.shard_manager.clone(); let shard_manager = client.shard_manager.clone();
#[cfg(feature = "stats")]
let cache = client.cache_and_http.cache.clone();
#[cfg(unix)] #[cfg(unix)]
let mut term: Option<Box<dyn Any + Send>> = Some(Box::new( let mut term: Option<Box<dyn Any + Send>> = Some(Box::new(
tokio::signal::unix::signal(SignalKind::terminate()) tokio::signal::unix::signal(SignalKind::terminate())
@ -104,13 +101,8 @@ async fn main() {
_ = tokio::time::sleep(std::time::Duration::from_secs(60)) => { _ = tokio::time::sleep(std::time::Duration::from_secs(60)) => {
#[cfg(feature = "stats")] #[cfg(feature = "stats")]
{ {
let guild_count = cache.guilds().len();
let active_count = session_manager.get_active_session_count().await; let active_count = session_manager.get_active_session_count().await;
if let Err(why) = stats_manager.set_server_count(guild_count) {
error!("Failed to update server count: {why}");
}
if let Err(why) = stats_manager.set_active_count(active_count) { if let Err(why) = stats_manager.set_active_count(active_count) {
error!("Failed to update active count: {why}"); error!("Failed to update active count: {why}");
} }

View File

@ -12,12 +12,6 @@ impl StatsManager {
Ok(StatsManager { redis }) Ok(StatsManager { redis })
} }
pub fn set_server_count(&self, count: usize) -> Result<()> {
let mut con = self.redis.get_connection()?;
con.set("sc-bot-total-servers", count.to_string())
}
pub fn set_active_count(&self, count: usize) -> Result<()> { pub fn set_active_count(&self, count: usize) -> Result<()> {
let mut con = self.redis.get_connection()?; let mut con = self.redis.get_connection()?;