mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-03 01:17:56 +03:00
* Fixed a typo on new isRestrained method at models
* Fixed a couple GlobalConfig var name that also has a typo * Updated migration to include a new index on state_date for user services (new isRestrained method on DeployedServices lookups by this field)
This commit is contained in:
parent
2a95cbd4b9
commit
e8367041c1
@ -180,7 +180,7 @@ class GlobalConfig:
|
||||
# Max number of services to be "preparing" at same time
|
||||
MAX_PREPARING_SERVICES = Config.section(GLOBAL_SECTION).value('maxPreparingServices', '15') # Defaults to 15 services at once (per service provider)
|
||||
# Max number of service to be at "removal" state at same time
|
||||
MAX_REMOVING_SERVICES = Config.section(GLOBAL_SECTION).value('maxRemovinggServices', '15') # Defaults to 15 services at once (per service provider)
|
||||
MAX_REMOVING_SERVICES = Config.section(GLOBAL_SECTION).value('maxRemovingServices', '15') # Defaults to 15 services at once (per service provider)
|
||||
# If we ignore limits (max....)
|
||||
IGNORE_LIMITS = Config.section(GLOBAL_SECTION).value('ignoreLimits', '0')
|
||||
# Number of services to initiate removal per run of CacheCleaner
|
||||
@ -221,7 +221,7 @@ class GlobalConfig:
|
||||
MAX_LOGS_PER_ELEMENT = Config.section(GLOBAL_SECTION).value('maxLogPerElement', '100')
|
||||
|
||||
# Time to restrain a deployed service in case it gives some error at some point
|
||||
RESTRAINT_TIME = Config.section(GLOBAL_SECTION).value('restainTime', '600')
|
||||
RESTRAINT_TIME = Config.section(GLOBAL_SECTION).value('restrainTime', '600')
|
||||
|
||||
initDone = False
|
||||
|
||||
|
@ -86,7 +86,7 @@ class ServiceCacheUpdater(Job):
|
||||
continue
|
||||
|
||||
if ds.isRestrained():
|
||||
logger.debug('Deployed service {0} is restrained, will check this later')
|
||||
logger.info('Deployed service {0} is restrained, will check this later'.format(ds.name))
|
||||
continue
|
||||
|
||||
# Get data related to actual state of cache
|
||||
|
@ -29,6 +29,9 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('uds', ['StatsEvents'])
|
||||
|
||||
# Adding index on 'UserService', fields ['state_date']
|
||||
db.create_index('uds__user_service', ['state_date'])
|
||||
|
||||
|
||||
# Changing field 'Log.created'
|
||||
db.alter_column('uds_log', 'created', self.gf('django.db.models.fields.DateTimeField')())
|
||||
@ -37,6 +40,9 @@ class Migration(SchemaMigration):
|
||||
db.alter_column('uds_log', 'owner_type', self.gf('django.db.models.fields.SmallIntegerField')())
|
||||
|
||||
def backwards(self, orm):
|
||||
# Removing index on 'UserService', fields ['state_date']
|
||||
db.delete_index('uds__user_service', ['state_date'])
|
||||
|
||||
# Deleting model 'StatsCounters'
|
||||
db.delete_table('uds_stats_c')
|
||||
|
||||
@ -254,7 +260,7 @@ class Migration(SchemaMigration):
|
||||
'src_hostname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
|
||||
'src_ip': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '15'}),
|
||||
'state': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '1', 'db_index': 'True'}),
|
||||
'state_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'state_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
|
||||
'unique_id': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'db_index': 'True'}),
|
||||
'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'userServices'", 'null': 'True', 'blank': 'True', 'to': "orm['uds.User']"})
|
||||
}
|
||||
|
@ -889,7 +889,7 @@ class DeployedService(models.Model):
|
||||
|
||||
date = getSqlDatetime() - timedelta(seconds=GlobalConfig.RESTRAINT_TIME.getInt())
|
||||
|
||||
if self.userServices.filter(state=State.ERROR, state_date__ge=date).count() >= 3:
|
||||
if self.userServices.filter(state=State.ERROR, state_date__gt=date).count() >= 3:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user