Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Tugas push yang sedang diproses melalui task queue bisa gagal karena berbagai alasan. Jika pengendali gagal menjalankan tugas (sehingga menampilkan kode status HTTP apa pun di luar rentang 200–299), App Engine akan mencoba kembali tugas tersebut hingga berhasil.
Secara default, sistem akan mengurangi tingkat percobaan ulang secara bertahap agar tidak membebani aplikasi Anda dengan terlalu banyak
permintaan. Namun, sistem akan menjadwalkan upaya percobaan ulang agar dilakukan maksimal satu jam sekali
hingga tugas berhasil.
Mencoba ulang tugas
Anda dapat menyesuaikan skema Anda sendiri untuk percobaan ulang tugas dengan
menambahkan parameter
coba ulang
di queue.yaml. Dengan penambahan ini, Anda dapat menentukan jumlah maksimum percobaan ulang tugas yang gagal dalam antrean tertentu. Anda juga dapat menetapkan batas waktu untuk percobaan ulang dan
mengontrol interval antar-percobaan.
Contoh berikut menunjukkan berbagai skenario percobaan ulang:
Dalam fooqueue, tugas dicoba ulang hingga tujuh kali dan hingga dua hari
sejak upaya eksekusi pertama. Setelah kedua batas terlampaui, tugas akan gagal
secara permanen.
Pada barqueue, App Engine akan mencoba ulang tugas, meningkatkan interval
secara linear di antara setiap percobaan ulang hingga mencapai backoff maksimum dan mencoba ulang
tanpa batas pada interval maksimum (sehingga interval antar permintaan adalah
10 detik, 20 detik, 30 detik, ..., 190 detik, 200 detik, 200 detik, ...).
Dalam bazqueue, interval percobaan ulang dimulai pada 10 detik, ditingkatkan tiga kali lipat,
lalu ditingkatkan secara linear, dan akhirnya dicoba ulang tanpa batas waktu pada
interval maksimum (sehingga interval antar permintaan adalah
10 detik, 20 detik, 40 detik, 80 detik, 160 detik, 240 detik, 300 detik, 300 detik, ...).
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-11 UTC."],[[["\u003cp\u003eTasks in a queue that fail are automatically retried by App Engine until they succeed, unless the return is between 200-299.\u003c/p\u003e\n"],["\u003cp\u003eRetry attempts are reduced gradually to avoid overloading the application, and then recur at a maximum of once per hour.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003equeue.yaml\u003c/code\u003e file can be used to customize the retry scheme, including the maximum number of retries, time limits, and intervals between attempts.\u003c/p\u003e\n"],["\u003cp\u003eThe example demonstrates how to configure retry parameters, including setting limits and specifying different retry intervals with varying linear increases or doublings, allowing for fine-tuned task retry behavior.\u003c/p\u003e\n"]]],[],null,["# Retrying Failed Push Tasks\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\nGo Java PHP Python\n\nPush tasks being processed via a task queue can fail for many reasons. If a handler\nfails to execute a task (and therefore returns any HTTP status code outside of\nthe range 200--299), App Engine retries the task until it succeeds.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n|\n| /services/access). If you are updating to the App Engine runtime, refer to the [Upgrade to second-generation runtimes]() page to learn about your migration options for legacy bundled services.\n\nBy default, the system gradually reduces the retry rate to avoid overloading your application with too many\nrequests, but schedules retry attempts to recur at a maximum of once per hour\nuntil the task succeeds.\n\nRetrying tasks\n--------------\n\nYou can customize your own scheme for task retries by\nadding the [retry\nparameters](/appengine/docs/standard/reference/queueref#retry_parameters)\nelement in [`queue.yaml`](/appengine/docs/standard/reference/queueref). This\naddition allows you to specify the maximum number of times to retry failed tasks\nin a specific queue. You can also set a time limit for retry attempts and\ncontrol the interval between attempts.\n\nThe following example demonstrates various retry scenarios:\n\n- In `fooqueue`, tasks are retried up to seven times and for up to two days from the first execution attempt. After both limits are passed, it fails permanently.\n- In `barqueue`, App Engine attempts to retry tasks, increasing the interval linearly between each retry until reaching the maximum backoff and retrying indefinitely at the maximum interval (so the intervals between requests are 10s, 20s, 30s, ..., 190s, 200s, 200s, ...).\n- In `bazqueue`, the retry interval starts at 10s, then doubles three times, then increases linearly, and finally retries indefinitely at the maximum interval (so the intervals between requests are 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, ...).\n\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cqueue-entries\u003e\n \u003cqueue\u003e\n \u003cname\u003efooqueue\u003c/name\u003e\n \u003crate\u003e1/s\u003c/rate\u003e\n \u003cretry-parameters\u003e\n \u003ctask-retry-limit\u003e7\u003c/task-retry-limit\u003e\n \u003ctask-age-limit\u003e2d\u003c/task-age-limit\u003e\n \u003c/retry-parameters\u003e\n \u003c/queue\u003e\n \u003cqueue\u003e\n \u003cname\u003ebarqueue\u003c/name\u003e\n \u003crate\u003e1/s\u003c/rate\u003e\n \u003cretry-parameters\u003e\n \u003cmin-backoff-seconds\u003e10\u003c/min-backoff-seconds\u003e\n \u003cmax-backoff-seconds\u003e200\u003c/max-backoff-seconds\u003e\n \u003cmax-doublings\u003e0\u003c/max-doublings\u003e\n \u003c/retry-parameters\u003e\n \u003c/queue\u003e\n \u003cqueue\u003e\n \u003cname\u003ebazqueue\u003c/name\u003e\n \u003crate\u003e1/s\u003c/rate\u003e\n \u003cretry-parameters\u003e\n \u003cmin-backoff-seconds\u003e10\u003c/min-backoff-seconds\u003e\n \u003cmax-backoff-seconds\u003e300\u003c/max-backoff-seconds\u003e\n \u003cmax-doublings\u003e3\u003c/max-doublings\u003e\n \u003c/retry-parameters\u003e\n \u003c/queue\u003e\n \u003c/queue-entries\u003e\n\nWhat's next\n-----------\n\n- Learn more about the [task queue parameters](/appengine/docs/standard/reference/queueref)."]]