Skip to content

Commit 614aa22

Browse files
committed
re-arrange
1 parent 9f4994b commit 614aa22

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/phoenix/sync/controller.ex

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ defmodule Phoenix.Sync.Controller do
196196
api = configured_api!(conn)
197197

198198
if interruptible_call?(params) do
199-
interruptible_call(CORS.call(conn), api, params, shape_fun)
199+
conn
200+
|> CORS.call()
201+
|> interruptible_call(api, params, shape_fun)
200202
else
201203
predefined_shape = call_shape_fun(shape_fun)
202204
sync_render_call(conn, api, params, predefined_shape)
@@ -234,12 +236,6 @@ defmodule Phoenix.Sync.Controller do
234236
Phoenix.Sync.Adapter.PlugApi.call(shape_api, CORS.call(conn), params)
235237
end
236238

237-
defp interruptible_call?(params) do
238-
params["live"] == "true"
239-
end
240-
241-
defp now, do: System.monotonic_time(:millisecond)
242-
243239
defp interruptible_call(conn, api, params, shape_fun) do
244240
predefined_shape = call_shape_fun(shape_fun)
245241

@@ -288,6 +284,12 @@ defmodule Phoenix.Sync.Controller do
288284
end
289285
end
290286

287+
defp interruptible_call?(params) do
288+
params["live"] == "true"
289+
end
290+
291+
defp now, do: System.monotonic_time(:millisecond)
292+
291293
# only calls to the embedded api can have their timeout's adjusted
292294
defp reduce_long_poll_timeout(%{long_poll_timeout: long_poll_timeout} = api, start_time) do
293295
timeout = long_poll_timeout - (now() - start_time)

0 commit comments

Comments
 (0)