Skip to content

Commit b75f91e

Browse files
committed
refator: revert task files to be the same as main
1 parent 5d8b8ef commit b75f91e

File tree

5 files changed

+17
-66
lines changed

5 files changed

+17
-66
lines changed

server/polar/checkout/tasks.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ def __init__(self, checkout_id: uuid.UUID) -> None:
1717
super().__init__(message)
1818

1919

20-
@actor(
21-
actor_name="checkout.handle_free_success",
22-
priority=TaskPriority.HIGH,
23-
)
20+
@actor(actor_name="checkout.handle_free_success", priority=TaskPriority.HIGH)
2421
async def handle_free_success(checkout_id: uuid.UUID) -> None:
2522
async with AsyncSessionMaker() as session:
2623
repository = CheckoutRepository.from_session(session)

server/polar/eventstream/tasks.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
from .service import send_event
44

55

6-
@actor(
7-
actor_name="eventstream.publish",
8-
priority=TaskPriority.HIGH,
9-
)
6+
@actor(actor_name="eventstream.publish", priority=TaskPriority.HIGH)
107
async def eventstream_publish(event: str, channels: list[str]) -> None:
118
await send_event(RedisMiddleware.get(), event, channels)

server/polar/integrations/stripe/tasks.py

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ async def wrapper(*args: Params.args, **kwargs: Params.kwargs) -> ReturnValue:
7777
class StripeTaskError(PolarTaskError): ...
7878

7979

80-
@actor(
81-
actor_name="stripe.webhook.account.updated",
82-
priority=TaskPriority.HIGH,
83-
)
80+
@actor(actor_name="stripe.webhook.account.updated", priority=TaskPriority.HIGH)
8481
@stripe_api_connection_error_retry
8582
async def account_updated(event_id: uuid.UUID) -> None:
8683
async with AsyncSessionMaker() as session:
@@ -91,10 +88,7 @@ async def account_updated(event_id: uuid.UUID) -> None:
9188
)
9289

9390

94-
@actor(
95-
actor_name="stripe.webhook.payment_intent.succeeded",
96-
priority=TaskPriority.HIGH,
97-
)
91+
@actor(actor_name="stripe.webhook.payment_intent.succeeded", priority=TaskPriority.HIGH)
9892
@stripe_api_connection_error_retry
9993
async def payment_intent_succeeded(event_id: uuid.UUID) -> None:
10094
async with AsyncSessionMaker() as session:
@@ -160,10 +154,7 @@ async def payment_intent_payment_failed(event_id: uuid.UUID) -> None:
160154
raise
161155

162156

163-
@actor(
164-
actor_name="stripe.webhook.setup_intent.succeeded",
165-
priority=TaskPriority.HIGH,
166-
)
157+
@actor(actor_name="stripe.webhook.setup_intent.succeeded", priority=TaskPriority.HIGH)
167158
@stripe_api_connection_error_retry
168159
async def setup_intent_succeeded(event_id: uuid.UUID) -> None:
169160
async with AsyncSessionMaker() as session:
@@ -182,8 +173,7 @@ async def setup_intent_succeeded(event_id: uuid.UUID) -> None:
182173

183174

184175
@actor(
185-
actor_name="stripe.webhook.setup_intent.setup_failed",
186-
priority=TaskPriority.HIGH,
176+
actor_name="stripe.webhook.setup_intent.setup_failed", priority=TaskPriority.HIGH
187177
)
188178
@stripe_api_connection_error_retry
189179
async def setup_intent_setup_failed(event_id: uuid.UUID) -> None:
@@ -201,10 +191,7 @@ async def setup_intent_setup_failed(event_id: uuid.UUID) -> None:
201191
raise
202192

203193

204-
@actor(
205-
actor_name="stripe.webhook.charge.pending",
206-
priority=TaskPriority.HIGH,
207-
)
194+
@actor(actor_name="stripe.webhook.charge.pending", priority=TaskPriority.HIGH)
208195
async def charge_pending(event_id: uuid.UUID) -> None:
209196
async with AsyncSessionMaker() as session:
210197
async with external_event_service.handle_stripe(session, event_id) as event:
@@ -224,10 +211,7 @@ async def charge_pending(event_id: uuid.UUID) -> None:
224211
)
225212

226213

227-
@actor(
228-
actor_name="stripe.webhook.charge.failed",
229-
priority=TaskPriority.HIGH,
230-
)
214+
@actor(actor_name="stripe.webhook.charge.failed", priority=TaskPriority.HIGH)
231215
async def charge_failed(event_id: uuid.UUID) -> None:
232216
async with AsyncSessionMaker() as session:
233217
async with external_event_service.handle_stripe(session, event_id) as event:
@@ -243,10 +227,7 @@ async def charge_failed(event_id: uuid.UUID) -> None:
243227
raise
244228

245229

246-
@actor(
247-
actor_name="stripe.webhook.charge.succeeded",
248-
priority=TaskPriority.HIGH,
249-
)
230+
@actor(actor_name="stripe.webhook.charge.succeeded", priority=TaskPriority.HIGH)
250231
@stripe_api_connection_error_retry
251232
async def charge_succeeded(event_id: uuid.UUID) -> None:
252233
async with AsyncSessionMaker() as session:
@@ -264,10 +245,7 @@ async def charge_succeeded(event_id: uuid.UUID) -> None:
264245
raise
265246

266247

267-
@actor(
268-
actor_name="stripe.webhook.refund.created",
269-
priority=TaskPriority.HIGH,
270-
)
248+
@actor(actor_name="stripe.webhook.refund.created", priority=TaskPriority.HIGH)
271249
@stripe_api_connection_error_retry
272250
async def refund_created(event_id: uuid.UUID) -> None:
273251
async with AsyncSessionMaker() as session:
@@ -282,10 +260,7 @@ async def refund_created(event_id: uuid.UUID) -> None:
282260
await refund_service.create_from_stripe(session, stripe_refund=refund)
283261

284262

285-
@actor(
286-
actor_name="stripe.webhook.refund.updated",
287-
priority=TaskPriority.HIGH,
288-
)
263+
@actor(actor_name="stripe.webhook.refund.updated", priority=TaskPriority.HIGH)
289264
@stripe_api_connection_error_retry
290265
async def refund_updated(event_id: uuid.UUID) -> None:
291266
async with AsyncSessionMaker() as session:
@@ -300,10 +275,7 @@ async def refund_updated(event_id: uuid.UUID) -> None:
300275
await refund_service.upsert_from_stripe(session, stripe_refund=refund)
301276

302277

303-
@actor(
304-
actor_name="stripe.webhook.refund.failed",
305-
priority=TaskPriority.HIGH,
306-
)
278+
@actor(actor_name="stripe.webhook.refund.failed", priority=TaskPriority.HIGH)
307279
@stripe_api_connection_error_retry
308280
async def refund_failed(event_id: uuid.UUID) -> None:
309281
async with AsyncSessionMaker() as session:
@@ -318,10 +290,7 @@ async def refund_failed(event_id: uuid.UUID) -> None:
318290
await refund_service.upsert_from_stripe(session, stripe_refund=refund)
319291

320292

321-
@actor(
322-
actor_name="stripe.webhook.charge.dispute.closed",
323-
priority=TaskPriority.HIGH,
324-
)
293+
@actor(actor_name="stripe.webhook.charge.dispute.closed", priority=TaskPriority.HIGH)
325294
@stripe_api_connection_error_retry
326295
async def charge_dispute_closed(event_id: uuid.UUID) -> None:
327296
async with AsyncSessionMaker() as session:
@@ -389,10 +358,7 @@ async def customer_subscription_deleted(event_id: uuid.UUID) -> None:
389358
raise
390359

391360

392-
@actor(
393-
actor_name="stripe.webhook.invoice.created",
394-
priority=TaskPriority.HIGH,
395-
)
361+
@actor(actor_name="stripe.webhook.invoice.created", priority=TaskPriority.HIGH)
396362
@stripe_api_connection_error_retry
397363
async def invoice_created(event_id: uuid.UUID) -> None:
398364
async with AsyncSessionMaker() as session:
@@ -414,10 +380,7 @@ async def invoice_created(event_id: uuid.UUID) -> None:
414380
return
415381

416382

417-
@actor(
418-
actor_name="stripe.webhook.invoice.paid",
419-
priority=TaskPriority.HIGH,
420-
)
383+
@actor(actor_name="stripe.webhook.invoice.paid", priority=TaskPriority.HIGH)
421384
@stripe_api_connection_error_retry
422385
async def invoice_paid(event_id: uuid.UUID) -> None:
423386
async with AsyncSessionMaker() as session:

server/polar/subscription/tasks.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ async def subscription_update_meters(subscription_id: uuid.UUID) -> None:
8686
await subscription_service.update_meters(session, subscription)
8787

8888

89-
@actor(
90-
actor_name="subscription.cancel_customer",
91-
priority=TaskPriority.HIGH,
92-
)
89+
@actor(actor_name="subscription.cancel_customer", priority=TaskPriority.HIGH)
9390
async def subscription_cancel_customer(customer_id: uuid.UUID) -> None:
9491
async with AsyncSessionMaker() as session:
9592
await subscription_service.cancel_customer(session, customer_id)

server/polar/webhook/tasks.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@ async def _webhook_event_send(
126126
await session.commit()
127127

128128

129-
@actor(
130-
actor_name="webhook_event.success",
131-
priority=TaskPriority.HIGH,
132-
)
129+
@actor(actor_name="webhook_event.success", priority=TaskPriority.HIGH)
133130
async def webhook_event_success(webhook_event_id: UUID) -> None:
134131
async with AsyncSessionMaker() as session:
135132
return await webhook_service.on_event_success(session, webhook_event_id)

0 commit comments

Comments
 (0)