mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-24 17:04:43 +00:00
Job concurrency per tournament is 1 so we don't have to scale too much on active queue. Pages no longer refresh automatically after navigating away from the bout board. Tournament backups are no longer deleted when restoring from a backup. Cloudflare is blocking manual backup imports so I have deleted that form on the backups page.
This commit is contained in:
@@ -149,7 +149,7 @@ SolidQueue plugin enabled in Puma
|
||||
```
|
||||
|
||||
I have deployed Mission Control as a UI for SolidQueue. The uri for mission control is `/jobs`.
|
||||
For the development environment, the user/password is dev/secret. For the production environment, it is defined by environment variables.
|
||||
For the development environment, the user/password is dev/secret. For the production environment, it is defined by environment variables WRESTLINGDEV_MISSION_CONTROL_USER/WRESTLINGDEV_MISSION_CONTROL_PASSWORD. You can see this in `config/environments/production.rb` and `config/environments/development.rb`.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
class AdvanceWrestlerJob < ApplicationJob
|
||||
queue_as :default
|
||||
# associations are not available here so we had to pass tournament_id when creating the job
|
||||
limits_concurrency to: 1, key: ->(_wrestler, _match, tournament_id) { "tournament:#{tournament_id}" }
|
||||
|
||||
def perform(wrestler, match)
|
||||
def perform(wrestler, match, tournament_id)
|
||||
# Get tournament from wrestler
|
||||
tournament = wrestler.tournament
|
||||
|
||||
@@ -29,4 +31,4 @@ class AdvanceWrestlerJob < ApplicationJob
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class CalculateSchoolScoreJob < ApplicationJob
|
||||
queue_as :default
|
||||
limits_concurrency to: 1, key: ->(school) { "tournament:#{school.tournament_id}" }
|
||||
|
||||
# Need for TournamentJobStatusIntegrationTest
|
||||
def self.perform_sync(school)
|
||||
@@ -35,4 +36,4 @@ class CalculateSchoolScoreJob < ApplicationJob
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class GenerateTournamentMatchesJob < ApplicationJob
|
||||
queue_as :default
|
||||
limits_concurrency to: 1, key: ->(tournament) { "tournament:#{tournament.id}" }
|
||||
|
||||
def perform(tournament)
|
||||
# Log information about the job
|
||||
@@ -17,4 +18,4 @@ class GenerateTournamentMatchesJob < ApplicationJob
|
||||
raise # Re-raise the error so it's properly recorded
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class TournamentBackupJob < ApplicationJob
|
||||
queue_as :default
|
||||
limits_concurrency to: 1, key: ->(tournament) { "tournament:#{tournament.id}" }
|
||||
|
||||
def perform(tournament, reason = nil)
|
||||
# Log information about the job
|
||||
@@ -29,4 +30,4 @@ class TournamentBackupJob < ApplicationJob
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class WrestlingdevImportJob < ApplicationJob
|
||||
queue_as :default
|
||||
limits_concurrency to: 1, key: ->(tournament) { "tournament:#{tournament.id}" }
|
||||
|
||||
def perform(tournament, import_data = nil)
|
||||
# Log information about the job
|
||||
@@ -30,4 +31,4 @@ class WrestlingdevImportJob < ApplicationJob
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class AdvanceWrestler
|
||||
def advance
|
||||
# Use perform_later which will execute based on centralized adapter config
|
||||
# This will be converted to inline execution in test environment by ActiveJob
|
||||
AdvanceWrestlerJob.perform_later(@wrestler, @last_match)
|
||||
AdvanceWrestlerJob.perform_later(@wrestler, @last_match, @tournament.id)
|
||||
end
|
||||
|
||||
def advance_raw
|
||||
@@ -29,4 +29,4 @@ class AdvanceWrestler
|
||||
PoolAdvance.new(@wrestler).advanceWrestler
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,7 +41,6 @@ class WrestlingdevImporter
|
||||
@tournament.matches.destroy_all
|
||||
@tournament.mat_assignment_rules.destroy_all # Explicitly destroy rules (might be redundant if Mat cascades)
|
||||
@tournament.delegates.destroy_all
|
||||
@tournament.tournament_backups.destroy_all
|
||||
@tournament.tournament_job_statuses.destroy_all
|
||||
# Note: Teampointadjusts are deleted via School/Wrestler cascade
|
||||
end
|
||||
|
||||
@@ -27,12 +27,3 @@ and will also delete all of your current data. It's best to use the create backu
|
||||
</tbody>
|
||||
</table>
|
||||
<br><br>
|
||||
<h3>Import Manual Backup</h3>
|
||||
<p>Paste the backup text here. Note, if this is formatted wrong, you'll need to restore a backup from above to fix it and you'll see an error in your background jobs.</p>
|
||||
<%= form_for(:tournament, url: import_manual_tournament_tournament_backups_path(@tournament)) do |f| %>
|
||||
<div class="field">
|
||||
<%= f.label 'Import text' %><br>
|
||||
<%= f.text_area :import_text, cols: "30", rows: "20" %>
|
||||
</div>
|
||||
<%= submit_tag "Import", class: "btn btn-success", data: { turbo_confirm: 'Are you sure? This will delete everything for the current tournament and restore it with the backup text pasted below.' } %>
|
||||
<% end %>
|
||||
|
||||
@@ -5,7 +5,23 @@
|
||||
// } );
|
||||
</script>
|
||||
<script>
|
||||
setTimeout("location.reload(true);",30000);
|
||||
const setUpMatchesRefresh = () => {
|
||||
if (window.__upMatchesRefreshTimeout) {
|
||||
clearTimeout(window.__upMatchesRefreshTimeout);
|
||||
}
|
||||
window.__upMatchesRefreshTimeout = setTimeout(() => {
|
||||
window.location.reload(true);
|
||||
}, 30000);
|
||||
};
|
||||
|
||||
document.addEventListener("turbo:load", setUpMatchesRefresh);
|
||||
// turbo:before-cache stops the timer refresh from occurring if you navigate away from up_matches
|
||||
document.addEventListener("turbo:before-cache", () => {
|
||||
if (window.__upMatchesRefreshTimeout) {
|
||||
clearTimeout(window.__upMatchesRefreshTimeout);
|
||||
window.__upMatchesRefreshTimeout = null;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
Reference in New Issue
Block a user