mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Refactor high volume into serialised service model
Just looks a bit tidier and less repetitive. I’ve only done this for the serialised service because: - we’re only checking this in places where we’re already using the serialised service - if we want to check this elsewhere there’s a good chance that new code should be using the serialised service, since it’ll itself be doing some kind of performance optimisation
This commit is contained in:
@@ -3,6 +3,7 @@ from functools import partial
|
||||
from threading import RLock
|
||||
|
||||
import cachetools
|
||||
from flask import current_app
|
||||
from notifications_utils.clients.redis import RequestCache
|
||||
from notifications_utils.serialised_model import (
|
||||
SerialisedModel,
|
||||
@@ -106,6 +107,10 @@ class SerialisedService(SerialisedModel):
|
||||
def api_keys(self):
|
||||
return SerialisedAPIKeyCollection.from_service_id(self.id)
|
||||
|
||||
@property
|
||||
def high_volume(self):
|
||||
return self.id in current_app.config['HIGH_VOLUME_SERVICE']
|
||||
|
||||
|
||||
class SerialisedAPIKey(SerialisedModel):
|
||||
ALLOWED_PROPERTIES = {
|
||||
|
||||
Reference in New Issue
Block a user