> For the complete documentation index, see [llms.txt](https://app.developers.karte.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://app.developers.karte.io/app-faq/implementing-fetch-completion.md).

# 設定値配信でのFetchCompletionの利用

## FetchCompletionの発生タイミングと各種の挙動

* fetch()の完了をハンドルするFetchCompletion( [iOS](https://plaidev.github.io/karte-sdk-docs/ios/latest/KarteVariables/Typealiases.html#/s:14KarteVariables15FetchCompletiona), [Android](https://plaidev.github.io/karte-sdk-docs/android/variables/latest/variables/io.karte.android.variables/-fetch-completion/index.html) )は、タイムアウトが発生した場合には以下のようなタイミングで呼び出されます。
  * 呼び出された際のcallback変数で、送信の成否が判定可能です。
  * 通信成功時では、キャッシュが一度削除された後に参照された値でキャッシュが更新されます。配信対象の接客サービスが存在しなかった場合等については留意してください。

|                                        | FetchCompletionの発生タイミング | callbackの引数として渡される値 | キャッシュ更新 |
| -------------------------------------- | ----------------------- | ------------------- | ------- |
| 正常時(ステータスコード200)                       | レスポンスの返却時               | true                | される     |
| 非正常時(※incident等でサーバーが正常なレスポンスを返せない場合等) | レスポンスの返却時               | false               | されない    |
| タイムアウト時                                | OS毎のタイムアウト判定時           | false               | されない    |
| 接続がない場合                                | 即時                      | false               | されない    |

## OS毎のタイムアウト判定の挙動

* iOS, Androidの双方で、イベント送信には[10秒のタイムアウト](/app-faq/app-faq-request-timeout.md)が設定されています
* Androidの場合は接続と通信それぞれのタイムアウトが存在し、それぞれに10秒のタイムアウトが設定されるため、最大20秒待機する場合があります
* iOS, Androidの双方で接続が無い場合には即時でfetch()が失敗し、そのタイミングでFetchCompletionが発生します

## timeout判定後のイベント再送

* 通常SDKはタイムアウトが判定された際に[イベントの再送](/app-faq/app-faq-support-for-resending.md)を行いますが、fetch()で送信される`_fetch_variables`については再送を行いません


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://app.developers.karte.io/app-faq/implementing-fetch-completion.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
