Skip to content

Commit

Permalink
Refactor gemfile and reduce ram usage
Browse files Browse the repository at this point in the history
Minor changes to how gems are loaded to reduce memory usage. Updated eye
script so that a shard should only use 384MB of ram now before restart.
  • Loading branch information
Humblemonk committed Jan 26, 2024
1 parent 5e6d5c7 commit beda23d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 8.6.3 - 2024-01-26
### Added
- Refactored Gemfile

## 8.6.2 - 2024-01-24
### Added
- Refactored sqlite usage
Expand Down
5 changes: 3 additions & 2 deletions dice_maiden.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dice bot for Discord
# Author: Humblemonk
# Version: 8.6.2
# Version: 8.6.3
# Copyright (c) 2017. All rights reserved.
# !/usr/bin/ruby
# If you wish to run a single instance of this bot, please follow the "Manual Install" section of the readme!
Expand All @@ -10,7 +10,6 @@
require 'discordrb'
require 'dicebag'
require 'dotenv'
require 'rest-client'

Dotenv.load
@total_shards = ENV['SHARD'].to_i
Expand All @@ -32,6 +31,8 @@
$db.busy_timeout = (10_000)
end

require 'rest-client' if @shard == 0

mutex = Mutex.new

if @shard == 0
Expand Down
2 changes: 1 addition & 1 deletion scripts/dice_maiden.eye
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Eye.app 'dice_maiden' do
working_dir cwd
env 'BUNDLE_GEMFILE' => "Gemfile"
trigger :flapping, times: 10, within: 1.minute, retry_in: 10.minutes
check :memory, :below => 512.megabytes, :every => 60.seconds, :times => 3
check :memory, :below => 384.megabytes, :every => 60.seconds, :times => 3

group 'shards' do
chain grace: 2.seconds
Expand Down

0 comments on commit beda23d

Please sign in to comment.