Add usage checking to cron

This commit is contained in:
Uku Taht 2021-02-19 15:15:56 +02:00
parent 9eff6b03ed
commit 2bab36a438
2 changed files with 10 additions and 8 deletions

View File

@ -177,6 +177,8 @@ if config_env() == :prod && !disable_cron do
extra_cron = [
# Daily at midday
{"0 12 * * *", Plausible.Workers.SendTrialNotifications},
# Daily at 14
{"0 14 * * *", Plausible.Workers.CheckUsage},
# Every 10 minutes
{"*/10 * * * *", Plausible.Workers.ProvisionSslCertificates}
]
@ -194,7 +196,8 @@ if config_env() == :prod && !disable_cron do
extra_queues = [
provision_ssl_certificates: 1,
trial_notification_emails: 1
trial_notification_emails: 1,
check_usage: 1
]
config :plausible, Oban,

View File

@ -8,14 +8,13 @@ We don't enforce any hard limits at the moment, we're still counting your stats
<br /><br />
In the last billing cycle (<%= date_format(@last_cycle.first) %> to <%= date_format(@last_cycle.first) %>), your account has used <%= @usage %> billable pageviews.
<%= if @usage <= 20_000_000 do %>
Based on that we recommend you select the <%= Plausible.Billing.Plans.suggested_plan_name(@usage) %> plan which runs at <%= Plausible.Billing.Plans.suggested_plan_cost(@usage) %>. You can also go with yearly billing to get 33% off.
<br /><br />
You can upgrade your subscription using our self-serve platform. The new charge will be prorated to reflect the amount you have already paid and the time until your current subscription is supposed to expire.
<br /><br />
<a href="https://plausible.io/settings">Click here</a> to go to your site settings. You can upgrade your subscription tier by clicking the 'change plan' link.
Based on that we recommend you select the <%= Plausible.Billing.Plans.suggested_plan_name(@usage) %> plan which runs at <%= Plausible.Billing.Plans.suggested_plan_cost(@usage) %>. You can also go with yearly billing to get 33% off.
<br /><br />
You can upgrade your subscription using our self-serve platform. The new charge will be prorated to reflect the amount you have already paid and the time until your current subscription is supposed to expire.
<br /><br />
<a href="https://plausible.io/settings">Click here</a> to go to your site settings. You can upgrade your subscription tier by clicking the 'change plan' link.
<% else %>
This is more than our standard plans, so please reply back to this email to get a quote for your volume.
This is more than our standard plans, so please reply back to this email to get a quote for your volume.
<% end %>
<br /><br />
Were the last two months extraordinary and you don't expect these higher traffic levels to continue? Reply to this email and we'll figure it out.