I have an interceptor where I typically inject Str...
# squarelibraries
c
I have an interceptor where I typically inject String data (static build time values... think "prod" vs "debug"). And I basically put that value in a header. But now, the value is no longer static, but is read from a file. I can put a runBlocking around the file read and be done with it. But this breaks strict mode which we try to abide by. Instead I can change the String to a lambda () -> String. So then in my chain from
chain.request.newBuilder().header("blah", myValue)
to
chain.request.newBuilder().header("blah", myValue.invoke())
It seems like this works and now I don't have to use a runblocking... but this seems too simple and my spidey sense is telling me that I'm actually making a bigger mistake here because on each network call I'm going to call myValue.invoke(). Am I missing anything here. Should I try to use a flowable? Kotlin lazy? Will invoke() get called on every network request so I'm actually creating a bottleneck? It was a simple ask from my TPM. "Hey take this static field and actually just read it from I/O" but since the okhttpClient is needed early in my code, we don't want to surround it with a runBlocking.
e
fine to do I/O inside the interceptor, it's running on okhttp's dispatcher thread pool
1
c
awesome
So one thing I was trying to do is "verify" myself that everything is running on the right thread. contemplated asking in #getting-started, but it's pretty much as simple as printing the current thread and viewing the logs right?