mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Disable Failing Webhooks (#11966)
* todo comment * add failures field to webhooks and sanitize * implement logic * use update instead of save * specify timeout and maximum number of retries * add tests
This commit is contained in:
@@ -61,6 +61,10 @@ export const schema = new Schema({
|
||||
}), shared.i18n.t('invalidUrl')],
|
||||
},
|
||||
enabled: { $type: Boolean, required: true, default: true },
|
||||
// How many times this webhook has failed, disabled after 10
|
||||
failures: { $type: Number, default: 0 },
|
||||
// When the last failure happened, if older than 1 month the number of failures is reset
|
||||
lastFailureAt: { $type: Date },
|
||||
options: {
|
||||
$type: Schema.Types.Mixed,
|
||||
required: true,
|
||||
@@ -76,7 +80,7 @@ export const schema = new Schema({
|
||||
});
|
||||
|
||||
schema.plugin(baseModel, {
|
||||
noSet: ['_id'],
|
||||
noSet: ['_id', 'failures', 'lastFailureAt'],
|
||||
timestamps: true,
|
||||
_id: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user