remove stats_sync_interval and stats_cache_interval from ClusterSettings model

This commit is contained in:
Eduardo Silva
2026-01-08 11:30:47 -03:00
parent dacaf2e4cc
commit 1593141932
3 changed files with 22 additions and 21 deletions

View File

@@ -89,17 +89,12 @@ class WorkerForm(forms.ModelForm):
class ClusterSettingsForm(forms.ModelForm): class ClusterSettingsForm(forms.ModelForm):
class Meta: class Meta:
model = ClusterSettings model = ClusterSettings
fields = [ fields = ['enabled', 'primary_enable_wireguard', 'cluster_mode', 'restart_mode', 'worker_display']
'enabled', 'primary_enable_wireguard', 'stats_sync_interval',
'stats_cache_interval', 'cluster_mode', 'restart_mode', 'worker_display'
]
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields['enabled'].label = _("Cluster Enabled") self.fields['enabled'].label = _("Cluster Enabled")
self.fields['primary_enable_wireguard'].label = _("Primary Enable WireGuard") self.fields['primary_enable_wireguard'].label = _("Primary Enable WireGuard")
self.fields['stats_sync_interval'].label = _("Stats Sync Interval (seconds)")
self.fields['stats_cache_interval'].label = _("Stats Cache Interval (seconds)")
self.fields['cluster_mode'].label = _("Cluster Mode") self.fields['cluster_mode'].label = _("Cluster Mode")
self.fields['restart_mode'].label = _("Restart Mode") self.fields['restart_mode'].label = _("Restart Mode")
self.fields['worker_display'].label = _("Worker Display") self.fields['worker_display'].label = _("Worker Display")
@@ -114,11 +109,6 @@ class ClusterSettingsForm(forms.ModelForm):
Column('primary_enable_wireguard', css_class='form-group col-md-6 mb-0'), Column('primary_enable_wireguard', css_class='form-group col-md-6 mb-0'),
css_class='form-row' css_class='form-row'
), ),
Row(
Column('stats_sync_interval', css_class='form-group col-md-6 mb-0'),
Column('stats_cache_interval', css_class='form-group col-md-6 mb-0'),
css_class='form-row'
),
Row( Row(
Column('cluster_mode', css_class='form-group col-md-6 mb-0'), Column('cluster_mode', css_class='form-group col-md-6 mb-0'),
Column('restart_mode', css_class='form-group col-md-6 mb-0'), Column('restart_mode', css_class='form-group col-md-6 mb-0'),
@@ -139,16 +129,8 @@ class ClusterSettingsForm(forms.ModelForm):
def clean(self): def clean(self):
cleaned_data = super().clean() cleaned_data = super().clean()
stats_sync_interval = cleaned_data.get('stats_sync_interval')
stats_cache_interval = cleaned_data.get('stats_cache_interval')
primary_enable_wireguard = cleaned_data.get('primary_enable_wireguard') primary_enable_wireguard = cleaned_data.get('primary_enable_wireguard')
if stats_sync_interval and stats_sync_interval < 60:
raise ValidationError(_("Stats sync interval must be at least 60 seconds."))
if stats_cache_interval and stats_cache_interval < 60:
raise ValidationError(_("Stats cache interval must be at least 60 seconds."))
if not primary_enable_wireguard: if not primary_enable_wireguard:
raise ValidationError(_("Disabling WireGuard on the master server is currently not supported.")) raise ValidationError(_("Disabling WireGuard on the master server is currently not supported."))

View File

@@ -0,0 +1,21 @@
# Generated by Django 5.2.9 on 2026-01-08 14:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cluster', '0013_alter_clustersettings_restart_mode_and_more'),
]
operations = [
migrations.RemoveField(
model_name='clustersettings',
name='stats_cache_interval',
),
migrations.RemoveField(
model_name='clustersettings',
name='stats_sync_interval',
),
]

View File

@@ -8,8 +8,6 @@ class ClusterSettings(models.Model):
name = models.CharField(default='cluster_settings', max_length=16, unique=True) name = models.CharField(default='cluster_settings', max_length=16, unique=True)
enabled = models.BooleanField(default=False) enabled = models.BooleanField(default=False)
primary_enable_wireguard = models.BooleanField(default=True) primary_enable_wireguard = models.BooleanField(default=True)
stats_sync_interval = models.IntegerField(default=60)
stats_cache_interval = models.IntegerField(default=60)
cluster_mode = models.CharField(default='mirror', max_length=16, choices=(('mirror', 'Mirror'), )) cluster_mode = models.CharField(default='mirror', max_length=16, choices=(('mirror', 'Mirror'), ))
restart_mode = models.CharField(default='auto', max_length=16, choices=(('auto', 'Automatic restart'),)) restart_mode = models.CharField(default='auto', max_length=16, choices=(('auto', 'Automatic restart'),))
worker_display = models.CharField( worker_display = models.CharField(