1- defmodule Codebattle.CodeCheck.Executor.RemoteRust do
1+ defmodule Codebattle.CodeCheck.Executor.RemoteZig do
22 @ moduledoc false
33
44 alias Codebattle.CodeCheck.Checker.Token
@@ -52,13 +52,12 @@ defmodule Codebattle.CodeCheck.Executor.RemoteRust do
5252
5353 def execute ( params , lang_meta ) do
5454 headers = [
55- { "content-type" , "application/json" } ,
56- { "content-encoding" , "deflate" }
55+ { "content-type" , "application/json" }
5756 ]
5857
59- Logger . debug ( "RemoteRustExecutor request params: #{ Jason . encode! ( params ) } " )
58+ Logger . debug ( "RemoteZigExecutor request params: #{ Jason . encode! ( params ) } " )
6059
61- body = params |> Jason . encode! ( ) |> :zlib . compress ( )
60+ body = Jason . encode! ( params )
6261
6362 now = :os . system_time ( :millisecond )
6463
@@ -67,26 +66,26 @@ defmodule Codebattle.CodeCheck.Executor.RemoteRust do
6766 |> Finch . request ( CodebattleHTTP , receive_timeout: Languages . get_timeout_ms ( lang_meta ) )
6867 |> case do
6968 { :ok , % Finch.Response { status: 200 , body: body } } ->
70- Logger . debug ( "RemoteRustExecutor Response #{ inspect ( body ) } " )
69+ Logger . debug ( "RemoteZigExecutor Response #{ inspect ( body ) } " )
7170
7271 Logger . error (
73- "RemoteRustExecutor success lang: #{ lang_meta . slug } , time_ms: #{ :os . system_time ( :millisecond ) - now } }"
72+ "RemoteZigExecutor success lang: #{ lang_meta . slug } , time_ms: #{ :os . system_time ( :millisecond ) - now } }"
7473 )
7574
7675 AtomizedMap . load ( body )
7776
7877 { :ok , % Finch.Response { status: status , body: body } } ->
7978 Logger . error (
80- "RemoteRustExecutor failure status: #{ status } , lang: #{ lang_meta . slug } ,time_ms: #{ :os . system_time ( :millisecond ) - now } , body: #{ inspect ( body ) } "
79+ "RemoteZigExecutor failure status: #{ status } , lang: #{ lang_meta . slug } ,time_ms: #{ :os . system_time ( :millisecond ) - now } , body: #{ inspect ( body ) } "
8180 )
8281
83- { :error , "RemoteRustExecutor failure: #{ inspect ( body ) } " }
82+ { :error , "RemoteZigExecutor failure: #{ inspect ( body ) } " }
8483
8584 { :error , finch_exception } ->
8685 reason = Exception . format ( :error , finch_exception , [ ] )
8786
8887 Logger . error (
89- "RemoteRustExecutor error lang: #{ lang_meta . slug } , time_ms: #{ :os . system_time ( :millisecond ) - now } , error: #{ inspect ( reason ) } "
88+ "RemoteZigExecutor error lang: #{ lang_meta . slug } , time_ms: #{ :os . system_time ( :millisecond ) - now } , error: #{ inspect ( reason ) } "
9089 )
9190
9291 { :error , :timeout }
@@ -97,9 +96,10 @@ defmodule Codebattle.CodeCheck.Executor.RemoteRust do
9796 to_string ( :rand . uniform ( 10_000_000 ) )
9897 end
9998
100- # defp runner_url(_lang), do: "http://localhost:4002/run"
101- defp runner_url ( lang ) do
102- namespace = Application . get_env ( :codebattle , :k8s_namespace , "default" )
103- "http://runner-#{ lang } .#{ namespace } .svc/run"
104- end
99+ defp runner_url ( _lang ) , do: "http://localhost:4040/run"
100+
101+ # defp runner_url(lang) do
102+ # namespace = Application.get_env(:codebattle, :k8s_namespace, "default")
103+ # "http://runner-#{lang}.#{namespace}.svc/run"
104+ # end
105105end
0 commit comments