dashbitco/flow

Keep getting this error when running a release.

jackalcooper opened this issue · 0 comments

12:19:12.137 [error] Error in process #PID<0.1821.0> on node :"subway_umbrella@127.0.0.1" with exit value:
{:undef,
 [{Flow, :from_enumerable,
   [%File.Stream{line_or_bytes: :line, modes: [:raw, :read_ahead, :binary],
     path: "/root/subway/nginx_log/ccb-access.log-20170226", raw: true}], []},
  {Honey.Nginx, :read, 3, [file: 'lib/honey/nginx.ex', line: 37]}]}

That's what I got from the log. It works perfectly when running with mix.
The part of code:

 def read(:file, file_path \\ @file_path, options \\ @default_options) do
        enum = File.stream!(file_path)
        options = [file_name: file_path] ++ options
        read(:enum, enum, options)
    end
    def read(:enum, enum, options) do
        file_name = options[:file_name]
        ets_table_name = file_name |> String.to_atom
        case Honey.ETSServer.create(ets_table_name) do
            {:new, ets_table} ->
                Logger.debug "new ets table: #{inspect ets_table}"
                enum
                    |> Flow.from_enumerable()
                    |> Flow.flat_map(&String.split(&1, "\n"))
                    |> Flow.partition()
                    |> Flow.partition(window: Flow.Window.count(1000), stages: 4)
                    |> Flow.reduce(fn -> [] end, fn line, acc ->