@@ -34,22 +34,20 @@ defmodule Commanded.Projections.Ecto do
3434    schema_prefix  = 
3535      opts [ :schema_prefix ]  ||  Application . get_env ( :commanded_ecto_projections ,  :schema_prefix ) 
3636
37+     timeout  =  opts [ :timeout ]  ||  :infinity 
38+     handler_opts  =  Keyword . drop ( opts ,  [ :repo ,  :schema_prefix ,  :timeout ] ) 
39+ 
3740    quote  location:  :keep  do 
3841      @ behaviour  Commanded.Projections.Ecto 
3942
40-       @ opts  unquote ( opts ) 
41-       @ repo  @ opts [ :repo ]  ||  Application . compile_env ( :commanded_ecto_projections ,  :repo )  || 
43+       @ repo  unquote ( opts [ :repo ] )  ||  Application . compile_env ( :commanded_ecto_projections ,  :repo )  || 
4244              raise ( "Commanded Ecto projections expects :repo to be configured in environment" ) 
43-       @ timeout  @ opts [ :timeout ]  ||  :infinity 
44- 
45-       # Pass through any other configuration to the event handler 
46-       @ handler_opts  Keyword . drop ( @ opts ,  [ :repo ,  :schema_prefix ,  :timeout ] ) 
4745
4846      unquote ( __include_schema_prefix__ ( schema_prefix ) ) 
4947      unquote ( __include_projection_version_schema__ ( ) ) 
5048
5149      use  Ecto.Schema 
52-       use  Commanded.Event.Handler ,  @ handler_opts 
50+       use  Commanded.Event.Handler ,  unquote ( handler_opts ) 
5351
5452      import  Ecto.Changeset 
5553      import  Ecto.Query 
@@ -106,7 +104,7 @@ defmodule Commanded.Projections.Ecto do
106104      end 
107105
108106      defp  transaction ( % Ecto.Multi { }  =  multi )  do 
109-         @ repo . transaction ( multi ,  timeout:  @ timeout ,  pool_timeout:  @ timeout ) 
107+         @ repo . transaction ( multi ,  timeout:  unquote ( timeout ) ,  pool_timeout:  unquote ( timeout ) ) 
110108      end 
111109
112110      defoverridable  schema_prefix:  1 ,  schema_prefix:  2 
0 commit comments