Optimize the query

main
Florent Daigniere 2 years ago
parent 07bf8ce6df
commit 84a722eabc

@ -28,5 +28,4 @@ def rspamd_dkim_key(domain_name):
@internal.route("/rspamd/local_domains", methods=['GET']) @internal.route("/rspamd/local_domains", methods=['GET'])
def rspamd_local_domains(): def rspamd_local_domains():
domains = set(models.Domain.query.all() + models.Alternative.query.all()) return '\n'.join(domain[0] for domain in models.Domain.query.with_entities(models.Domain.name).all() + models.Alternative.query.with_entities(models.Alternative.name).all())
return '\n'.join(map(str,domains))

Loading…
Cancel
Save