Skip to content

Commit

Permalink
DataStream: make sure chunksize has a value
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardochimal committed Jul 16, 2010
1 parent 9fc1d9e commit 84bf836
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/taps/data_stream.rb
Expand Up @@ -9,6 +9,8 @@ module Taps
class DataStream
class CorruptedData < Exception; end

DEFAULT_CHUNKSIZE = 1000

attr_reader :db, :state

def initialize(db, state)
Expand All @@ -19,6 +21,7 @@ def initialize(db, state)
:num_chunksize => 0,
:total_chunksize => 0,
}.merge(state)
@state[:chunksize] ||= DEFAULT_CHUNKSIZE
@complete = false
end

Expand Down Expand Up @@ -223,6 +226,7 @@ class DataStreamKeyed < DataStream
def initialize(db, state)
super(db, state)
@state = { :primary_key => order_by(state[:table_name]).first, :filter => 0 }.merge(state)
@state[:chunksize] ||= DEFAULT_CHUNKSIZE
@buffer = []
end

Expand Down

0 comments on commit 84bf836

Please sign in to comment.