content_server 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -241,18 +241,15 @@ module ContentData
241
241
  return_str = ""
242
242
  contents_str = ""
243
243
  instances_str = ""
244
- instances_counter = 0
245
244
  each_content { |checksum, size, content_mod_time|
246
245
  contents_str << "%s,%d,%d\n" % [checksum, size, content_mod_time]
247
246
  }
248
- instances_counter = 0
249
247
  each_instance { |checksum, size, content_mod_time, instance_mod_time, server, path|
250
- instances_counter += 1
251
248
  instances_str << "%s,%d,%s,%s,%d\n" % [checksum, size, server, path, instance_mod_time]
252
249
  }
253
250
  return_str << "%d\n" % [@contents_info.length]
254
251
  return_str << contents_str
255
- return_str << "%d\n" % [instances_counter]
252
+ return_str << "%d\n" % [@instances_info.length]
256
253
  return_str << instances_str
257
254
  return_str
258
255
  end
@@ -260,7 +257,16 @@ module ContentData
260
257
  def to_file(filename)
261
258
  content_data_dir = File.dirname(filename)
262
259
  FileUtils.makedirs(content_data_dir) unless File.directory?(content_data_dir)
263
- File.open(filename, 'w') {|f| f.write(to_s) }
260
+ file = File.open(filename, 'w')
261
+ file.write("#{@contents_info.length}\n")
262
+ each_content { |checksum, size, content_mod_time|
263
+ file.write("#{checksum},#{size},#{content_mod_time}\n")
264
+ }
265
+ file.write("#{@instances_info.length}\n")
266
+ each_instance { |checksum, size, _, instance_mod_time, server, path|
267
+ file.write("#{checksum},#{size},#{server},#{path},#{instance_mod_time}\n")
268
+ }
269
+ file.close
264
270
  end
265
271
 
266
272
  # TODO validation that file indeed contains ContentData missing
@@ -97,7 +97,7 @@ module ContentServer
97
97
  loop{
98
98
  sleep(Params['data_flush_delay'])
99
99
  Log.info('Start flush local content data to file.')
100
- $testing_memory_log.info('Start flush content data to file') if $testing_memory_log
100
+ $testing_memory_log.info('Start flush content data to file') if $testing_memory_active
101
101
  written_to_file = false
102
102
  $local_content_data_lock.synchronize{
103
103
  local_content_data_unique_id = $local_content_data.unique_id
@@ -106,11 +106,11 @@ module ContentServer
106
106
  $local_content_data.to_file($tmp_content_data_file)
107
107
  written_to_file = true
108
108
  else
109
- Log.debug1('no need to flush. content data has not changed')
109
+ Log.info('no need to flush. content data has not changed')
110
110
  end
111
111
  }
112
112
  File.rename($tmp_content_data_file, Params['local_content_data_path']) if written_to_file
113
- $testing_memory_log.info("End flush content data to file") if $testing_memory_log
113
+ $testing_memory_log.info("End flush content data to file") if $testing_memory_active
114
114
  }
115
115
  end
116
116
 
@@ -1,3 +1,3 @@
1
1
  module ContentServer
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -123,7 +123,8 @@ module TestingMemory
123
123
  email_report += generate_mem_report
124
124
  email_report += "indexed files:#{$indexed_file_count}\n"
125
125
  $testing_memory_log.info("indexed files:#{$indexed_file_count}")
126
- puts "indexed files:#{$indexed_file_count}"
126
+ puts("indexed files:#{$indexed_file_count}")
127
+ #puts("symobles size:#{Symbol.all_symbols.size}")
127
128
  if total_files == $indexed_file_count
128
129
  stop_time = Time.now
129
130
  email_report += "\nAt this point all files are indexed. No mem changes should occur\n"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: content_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-03 00:00:00.000000000 Z
12
+ date: 2013-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake