Đến nội dung
BankGatewayBankGateway
Console ↗
↑ ↓ Điều hướng↵ ChọnEsc Đóng
Mục lục tài liệu:Giới hạn tần suất gọi ▾
Tài liệu›Xử lý lỗi & Vận hành›Giới hạn tần suất gọi
Phiên bản:v1.0.5 (Chính thức)

Giới hạn tần suất gọi

Quy tắc kiểm soát tốc độ gọi (Rate Limiting) và chiến lược gửi lại (Exponential Backoff).

Hạn mức tốc độ mặc định

Gói dịch vụTốc độ tối đa (QPS)Chính sách quá tải
Free / Starter10 requests / giâyHTTP 429 kèm Retry-After
Pro VIP60 requests / giâyHTTP 429 kèm Retry-After
Enterprise120 - 500 requests / giâyCụm dedicated worker riêng

Thuật toán gửi lại an toàn (Jitter Backoff)

retry-helper.js
// Thuật toán gửi lại an toàn khi gặp 429 hoặc timeout
async function fetchWithRetry(url, options, maxRetries = 3) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    try {
      const res = await fetch(url, options);
      if (res.status === 429) {
        const retryAfter = Number(res.headers.get("Retry-After") || 2);
        await new Promise(r => setTimeout(r, retryAfter * 1000));
        continue;
      }
      return res;
    } catch (err) {
      if (attempt === maxRetries - 1) throw err;
      const delay = Math.min(10000, 1000 * Math.pow(2, attempt) + Math.random() * 500);
      await new Promise(r => setTimeout(r, delay));
    }
  }
}
Tài liệu phát hành theo chuẩn OpenBanking 2.0 · Cập nhật v1.0.5 (Chính thức)Góp ý tài liệu & Báo lỗi ↗