Add `templateId` support to `setUserFlairBatch`

オープン
#282 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
58/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript
領域
api

調査の方向性

Start by locating the TypeScript implementation and callers of setUserFlairBatch, then compare it with the single-user flair method to understand the existing request shape. Add optional templateId handling without changing behavior for existing callers; done means batches can apply a template to up to 25 users while non-template updates continue to work.

索引モデルが issue の本文から書いたものです。

説明

Summary

Devvit’s batch flair update method does not support templateId. For large subreddits and high‑volume automated systems, this creates a significant operational bottleneck. When a flair template is required, every user must be updated individually because the batch method cannot apply templates.

I propose adding optional templateId support to setUserFlairBatch so that template‑based flair updates can be performed in efficient batches rather than thousands of single‑user calls.

Problem

The single‑user flair method works for small subs and occasional updates. It does not scale for apps that update thousands of users daily.

Streak-Tracker updates the flair of every user once per day. We currently have more than 5.3k users, and the number grows by 30 to 60 users per day. Because the batch method cannot apply a flair template, all updates must be performed through the single‑user method. This results in more than 5.3k API calls every day for flair updates alone.

This creates a compounding operational problem:

  • The app must perform thousands of individual flair updates because batch updates cannot apply flair templates.
  • Daily flair updates become slower and more fragile as the userbase grows.
  • The lack of batching forces unnecessary load on both the app and Reddit’s infrastructure.

As the app scales, this limitation becomes harder to sustain for time‑sensitive workflows that depend on reliable daily flair updates.

Proposed Solution

Add optional templateId support to setUserFlairBatch.

Batch flair updates should be able to apply a flair template to multiple users in a single request. This would allow apps to update up to 25 users per call instead of performing thousands of individual updates.

With batching, daily flair updates would drop from more than 5.3k calls to roughly 212. This is a 96 percent reduction in API usage and would significantly improve reliability for high‑volume systems.

This proposal is intended to improve operational efficiency, not change existing flair behaviour. Apps that do not use templates can continue using the current batch method. Apps that require templates could perform batch flair updates using an optional templateId field.

Use Case

For large subreddits with automated flair systems, batch flair updates with optional templateId support would:

  • Reduce daily API usage by thousands of calls.
  • Make daily flair updates faster and more predictable.
  • Reduce queue congestion for apps that perform other high‑volume tasks.

In my case, optional templateId support in batch flair updates would allow the app to update thousands of users efficiently instead of performing thousands of individual flair updates every day.

This request is motivated by a real scaling need, but the same capability would benefit any Devvit app that performs high‑volume flair updates.

Alternatives Considered

Continuing to use the single‑user flair method is not viable at scale. It forces thousands of unnecessary calls, increases operational fragility, and limits the growth of automated systems that rely on daily flair updates.

Adding optional templateId support to batch flair updates follows the principle of efficiency: apps can perform the same work with far fewer calls, while Reddit’s backend retains full control over flair validation and template behaviour.

主要言語
TypeScript
スター
210
フォーク
88
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

reddit/devvit のほかの issue

reddit/devvit の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。