antiDuplicationPolicy refactor opts

This commit is contained in:
Alex Gleason 2023-03-29 23:53:07 -05:00
parent b32bfef342
commit 37213aec65
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

View File

@ -17,9 +17,11 @@ interface AntiDuplication {
* Only messages that meet the minimum length criteria are selected. * Only messages that meet the minimum length criteria are selected.
*/ */
const antiDuplicationPolicy: Policy<AntiDuplication> = async (msg, opts = {}) => { const antiDuplicationPolicy: Policy<AntiDuplication> = async (msg, opts = {}) => {
const ttl = opts.ttl ?? 60000; const {
const minLength = opts.minLength ?? 50; ttl = 60000,
const databaseUrl = opts.databaseUrl ?? 'sqlite:///tmp/strfry-anti-duplication-policy.sqlite3'; minLength = 50,
databaseUrl = 'sqlite:///tmp/strfry-anti-duplication-policy.sqlite3',
} = opts;
const { kind, content } = msg.event; const { kind, content } = msg.event;