air18n 0.1.37 → 0.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/air18n/chunk_cache.rb +7 -4
- data/lib/air18n/version.rb +1 -1
- metadata +1 -1
data/lib/air18n/chunk_cache.rb
CHANGED
@@ -28,7 +28,9 @@ module Air18n
|
|
28
28
|
|
29
29
|
1.upto(num_chunks) do |i|
|
30
30
|
chunk = value_json[(i-1)*MAX_CHUNK_SIZE, MAX_CHUNK_SIZE]
|
31
|
-
|
31
|
+
if cache.write(CHUNK_CACHE_KEY % [key, i], chunk, :expires_in => expires_in) == false
|
32
|
+
LoggingHelper.error "ChunkCache set: failed to write chunk #{CHUNK_CACHE_KEY % [key, i]} (#{chunk.size} bytes)"
|
33
|
+
end
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
@@ -39,7 +41,7 @@ module Air18n
|
|
39
41
|
if chunk
|
40
42
|
num_chunks, checksum = JSON.parse(chunk)
|
41
43
|
else
|
42
|
-
LoggingHelper.error
|
44
|
+
LoggingHelper.error "ChunkCache get: no checksum stored for #{key}"
|
43
45
|
return nil
|
44
46
|
end
|
45
47
|
|
@@ -47,7 +49,8 @@ module Air18n
|
|
47
49
|
chunk = cache.read(CHUNK_CACHE_KEY % [key, i])
|
48
50
|
|
49
51
|
if chunk.nil?
|
50
|
-
#
|
52
|
+
# Return nil if any chunk is missing.
|
53
|
+
LoggingHelper.error "ChunkCache get: chunk #{CHUNK_CACHE_KEY % [key, i]} is missing"
|
51
54
|
return nil
|
52
55
|
end
|
53
56
|
|
@@ -55,7 +58,7 @@ module Air18n
|
|
55
58
|
end
|
56
59
|
|
57
60
|
if Zlib::crc32(buffer) != checksum
|
58
|
-
LoggingHelper.error
|
61
|
+
LoggingHelper.error "ChunkCache get: invalid checksum for #{key}"
|
59
62
|
return nil
|
60
63
|
else
|
61
64
|
return JSON.parse(buffer)[0]
|
data/lib/air18n/version.rb
CHANGED