Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds cron endpoint to keep team subscriptions in sync #7992

Merged
merged 7 commits into from
Mar 28, 2023

Conversation

zomars
Copy link
Member

@zomars zomars commented Mar 28, 2023

What does this PR do?

  • Repurposed the downgrade cron endpoint (which wasn't being used anymore) to keep team subscriptions in sync with Stripe
  • Updated the interval to run once a day at midnight
  • Added possibility to trigger the endpoint manually as well

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

  • Trigger from Github Actions
  • Check logs

@zomars zomars requested review from a team March 28, 2023 19:03
@vercel
Copy link

vercel bot commented Mar 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
cal ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 28, 2023 at 7:32PM (UTC)
dhe ❌ Failed (Inspect) Mar 28, 2023 at 7:32PM (UTC)
1 Ignored Deployment
Name Status Preview Comments Updated
ui ⬜️ Ignored (Inspect) Mar 28, 2023 at 7:32PM (UTC)

@@ -1,5 +1,8 @@
import type { NextApiRequest, NextApiResponse } from "next";

import { updateQuantitySubscriptionFromStripe } from "@calcom/features/ee/teams/lib/payments";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename file?

@@ -1,11 +1,12 @@
name: Cron - downgradeUsers

on:
workflow_dispatch:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can trigger manually

@zomars zomars changed the title Adds cron endpoint to handle keep team subscriptions in sync Adds cron endpoint to keep team subscriptions in sync Mar 28, 2023
Stripe allow up to 100 per second
@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 233.32 KB (🟡 +1 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

zomars added a commit that referenced this pull request Mar 28, 2023
* Fix missing edge case where team is paid but needs to be updated

* Reuses cron endpoint to update team subscriptions

* Update cron-downgradeUsers.yml

* Update payments.ts

* Update cron-downgradeUsers.yml

* update to 90 writes per second

Stripe allow up to 100 per second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants