Sha256: af8b496c53d4d4bb6e1e82c14287f65583badeaf6a0af013941be4157d91995b

Contents?: true

Size: 283 Bytes

Versions: 26

Compression:

Stored size: 283 Bytes

Contents

module Routemaster
  module Middleware
    class PayloadFilter
      # Filters duplicate events by url and type in a single payload.
      def run(payload)
        payload.group_by { |event| [event['url'], event['type']] }.map { |_, events| events.last }
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
routemaster-drain-3.0.0 lib/routemaster/middleware/payload_filter.rb
routemaster-drain-2.5.4 lib/routemaster/middleware/payload_filter.rb
routemaster-drain-2.5.3 lib/routemaster/middleware/payload_filter.rb
routemaster-drain-2.5.2 lib/routemaster/middleware/payload_filter.rb
routemaster-drain-2.5.1 lib/routemaster/middleware/payload_filter.rb
routemaster-drain-2.5.0 lib/routemaster/middleware/payload_filter.rb