nanoc-core 4.11.17 → 4.11.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nanoc/core.rb +1 -0
- data/lib/nanoc/core/compilation_phases/write.rb +8 -48
- data/lib/nanoc/core/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd4fffaf7813aba1bc2544b16ff1cf801f141a293605c4cd3a4f44d26e6baf02
|
4
|
+
data.tar.gz: a11c2bd8d095dbfcfddc00628cf2a65115184dee3cbedd3ea956d17ce0551f57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26a6cf153b5cb6c2fc0c12e1597ab4a77dd6ff52cf95fa90e9b636f684caf819e883677cfbe3d60a179f2f87c548be5a4f436c56f2e981b2691908163844628a
|
7
|
+
data.tar.gz: 2b2dcbaf7d2b0c41a7d9558af9b33c3e7eafa5b8986ec230fb31c74c916beb4912872f80ffa63f02eea9558c60f5e4723ee08d71ece1731ae8d107b5e847b990
|
data/lib/nanoc/core.rb
CHANGED
@@ -6,45 +6,6 @@ module Nanoc
|
|
6
6
|
class Write < Abstract
|
7
7
|
include Nanoc::Core::ContractsSupport
|
8
8
|
|
9
|
-
class Worker
|
10
|
-
def initialize(queue:, compiled_content_store:)
|
11
|
-
@queue = queue
|
12
|
-
@compiled_content_store = compiled_content_store
|
13
|
-
end
|
14
|
-
|
15
|
-
def start
|
16
|
-
@thread = Thread.new do
|
17
|
-
Thread.current.abort_on_exception = true
|
18
|
-
Thread.current.priority = -1 # schedule I/O work ASAP
|
19
|
-
|
20
|
-
writer = Nanoc::Core::ItemRepWriter.new
|
21
|
-
|
22
|
-
while rep = @queue.pop # rubocop:disable Lint/AssignmentInCondition
|
23
|
-
writer.write_all(rep, @compiled_content_store)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def join
|
29
|
-
@thread.join
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class WorkerPool
|
34
|
-
def initialize(queue:, size:, compiled_content_store:)
|
35
|
-
@workers = Array.new(size) { Worker.new(queue: queue, compiled_content_store: compiled_content_store) }
|
36
|
-
end
|
37
|
-
|
38
|
-
def start
|
39
|
-
@workers.each(&:start)
|
40
|
-
end
|
41
|
-
|
42
|
-
def join
|
43
|
-
@workers.each(&:join)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
QUEUE_SIZE = 40
|
48
9
|
WORKER_POOL_SIZE = 5
|
49
10
|
|
50
11
|
def initialize(compiled_content_store:, wrapped:)
|
@@ -52,19 +13,16 @@ module Nanoc
|
|
52
13
|
|
53
14
|
@compiled_content_store = compiled_content_store
|
54
15
|
|
55
|
-
@
|
56
|
-
@worker_pool = WorkerPool.new(queue: @queue, size: WORKER_POOL_SIZE, compiled_content_store: @compiled_content_store)
|
57
|
-
end
|
16
|
+
@pool = Concurrent::FixedThreadPool.new(WORKER_POOL_SIZE)
|
58
17
|
|
59
|
-
|
60
|
-
super
|
61
|
-
@worker_pool.start
|
18
|
+
@writer = Nanoc::Core::ItemRepWriter.new
|
62
19
|
end
|
63
20
|
|
64
21
|
def stop
|
22
|
+
@pool.shutdown
|
23
|
+
@pool.wait_for_termination
|
24
|
+
|
65
25
|
super
|
66
|
-
@queue.close
|
67
|
-
@worker_pool.join
|
68
26
|
end
|
69
27
|
|
70
28
|
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
@@ -76,7 +34,9 @@ module Nanoc
|
|
76
34
|
# notification happens before the :rep_write_enqueued one.
|
77
35
|
Nanoc::Core::NotificationCenter.post(:rep_write_enqueued, rep)
|
78
36
|
|
79
|
-
@
|
37
|
+
@pool.post do
|
38
|
+
@writer.write_all(rep, @compiled_content_store)
|
39
|
+
end
|
80
40
|
end
|
81
41
|
end
|
82
42
|
end
|
data/lib/nanoc/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.11.
|
4
|
+
version: 4.11.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: concurrent-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: ddmemoize
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|