# Operations are being batched even when batching is disabled by default

**URL:** <https://community.apollographql.com/t/operations-are-being-batched-even-when-batching-is-disabled-by-default/7145>\
**Category:** Client SDKs\
**Tags:** mobile, kotlin\
**Created:** [January 22, 2024, 6:24am UTC](https://community.apollographql.com/t/operations-are-being-batched-even-when-batching-is-disabled-by-default/7145 "2024-01-22T06:24:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArjanSM](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/arjansm/32/1689_2.png) [@ArjanSM](https://community.apollographql.com/u/ArjanSM)\
**Post date:** [January 22, 2024, 6:24am UTC](https://community.apollographql.com/t/operations-are-being-batched-even-when-batching-is-disabled-by-default/7145/1 "2024-01-22T06:24:44Z")

</div>

Hi Team, 👋

I’ve the apollo client with `httpBatching` disabled by default:-

```auto
val apolloClient = ApolloClient
                .Builder()
                .serverUrl(mockWebServer.url("/").toString())
                .okHttpClient(get<OkHttpClient>())
                .addCustomScalarAdapter(Date.type, dateCustomTypeAdapter)
                .addInterceptor(HttpRequestHeadersInterceptor())
                .httpBatching(10, 10, false)
                .build()

```

My assumption is that if I execute operations below using the client defined above, they would not be batched.

```auto
val result1 = async {
      apolloClient.query(GetLaunchQuery()).execute()
    }
    val result2 = async {
      delay(50)
      apolloClient.query(GetLaunch2Query()).execute()
    }

```

But what I notice is that these operations are batched. Is this expected?  
Based on my understanding they shouldn’t, because the `apolloClient` does not have batching enabled by default.

I just wanted to make sure my understanding is correct.

---

<div class="post-metadata">

**Author:** ![ArjanSM](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/arjansm/32/1689_2.png) [@ArjanSM](https://community.apollographql.com/u/ArjanSM)\
**Post date:** [January 22, 2024, 4:10pm UTC](https://community.apollographql.com/t/operations-are-being-batched-even-when-batching-is-disabled-by-default/7145/2 "2024-01-22T16:10:05Z")

</div>

@mbonnin any suggestions!

---

<div class="post-metadata">

**Author:** ![mbonnin](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/mbonnin/32/13_2.png) [@mbonnin](https://community.apollographql.com/u/mbonnin)\
**Post date:** [January 22, 2024, 4:42pm UTC](https://community.apollographql.com/t/operations-are-being-batched-even-when-batching-is-disabled-by-default/7145/3 "2024-01-22T16:42:04Z")

</div>

You are 100% correct, this is a bug. Fix is [there](https://github.com/apollographql/apollo-kotlin/pull/5552).

In the meantime, you can enable/disable batching per-query:

```kotlin
apolloClient.query(GetLaunchQuery()).canBeBatched(false).execute()

```

If this is in many places, you can write a small extension function:

```kotlin
fun <D : Query.Data> ApolloClient.queryBatchingDisabled(query: Query<D>): ApolloCall<D> {
    return query(query).canBeBatched(false)
}

```
