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`.
|
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
|
## Environment Variables
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
class AdvanceWrestlerJob < ApplicationJob
|
class AdvanceWrestlerJob < ApplicationJob
|
||||||
queue_as :default
|
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
|
# Get tournament from wrestler
|
||||||
tournament = wrestler.tournament
|
tournament = wrestler.tournament
|
||||||
|
|
||||||
@@ -29,4 +31,4 @@ class AdvanceWrestlerJob < ApplicationJob
|
|||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class CalculateSchoolScoreJob < ApplicationJob
|
class CalculateSchoolScoreJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
limits_concurrency to: 1, key: ->(school) { "tournament:#{school.tournament_id}" }
|
||||||
|
|
||||||
# Need for TournamentJobStatusIntegrationTest
|
# Need for TournamentJobStatusIntegrationTest
|
||||||
def self.perform_sync(school)
|
def self.perform_sync(school)
|
||||||
@@ -35,4 +36,4 @@ class CalculateSchoolScoreJob < ApplicationJob
|
|||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class GenerateTournamentMatchesJob < ApplicationJob
|
class GenerateTournamentMatchesJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
limits_concurrency to: 1, key: ->(tournament) { "tournament:#{tournament.id}" }
|
||||||
|
|
||||||
def perform(tournament)
|
def perform(tournament)
|
||||||
# Log information about the job
|
# Log information about the job
|
||||||
@@ -17,4 +18,4 @@ class GenerateTournamentMatchesJob < ApplicationJob
|
|||||||
raise # Re-raise the error so it's properly recorded
|
raise # Re-raise the error so it's properly recorded
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class TournamentBackupJob < ApplicationJob
|
class TournamentBackupJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
limits_concurrency to: 1, key: ->(tournament) { "tournament:#{tournament.id}" }
|
||||||
|
|
||||||
def perform(tournament, reason = nil)
|
def perform(tournament, reason = nil)
|
||||||
# Log information about the job
|
# Log information about the job
|
||||||
@@ -29,4 +30,4 @@ class TournamentBackupJob < ApplicationJob
|
|||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class WrestlingdevImportJob < ApplicationJob
|
class WrestlingdevImportJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
limits_concurrency to: 1, key: ->(tournament) { "tournament:#{tournament.id}" }
|
||||||
|
|
||||||
def perform(tournament, import_data = nil)
|
def perform(tournament, import_data = nil)
|
||||||
# Log information about the job
|
# Log information about the job
|
||||||
@@ -30,4 +31,4 @@ class WrestlingdevImportJob < ApplicationJob
|
|||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class AdvanceWrestler
|
|||||||
def advance
|
def advance
|
||||||
# Use perform_later which will execute based on centralized adapter config
|
# Use perform_later which will execute based on centralized adapter config
|
||||||
# This will be converted to inline execution in test environment by ActiveJob
|
# 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
|
end
|
||||||
|
|
||||||
def advance_raw
|
def advance_raw
|
||||||
@@ -29,4 +29,4 @@ class AdvanceWrestler
|
|||||||
PoolAdvance.new(@wrestler).advanceWrestler
|
PoolAdvance.new(@wrestler).advanceWrestler
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ class WrestlingdevImporter
|
|||||||
@tournament.matches.destroy_all
|
@tournament.matches.destroy_all
|
||||||
@tournament.mat_assignment_rules.destroy_all # Explicitly destroy rules (might be redundant if Mat cascades)
|
@tournament.mat_assignment_rules.destroy_all # Explicitly destroy rules (might be redundant if Mat cascades)
|
||||||
@tournament.delegates.destroy_all
|
@tournament.delegates.destroy_all
|
||||||
@tournament.tournament_backups.destroy_all
|
|
||||||
@tournament.tournament_job_statuses.destroy_all
|
@tournament.tournament_job_statuses.destroy_all
|
||||||
# Note: Teampointadjusts are deleted via School/Wrestler cascade
|
# Note: Teampointadjusts are deleted via School/Wrestler cascade
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,12 +27,3 @@ and will also delete all of your current data. It's best to use the create backu
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<br><br>
|
<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>
|
||||||
<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>
|
</script>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
Reference in New Issue
Block a user