Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 057926e

Browse files
Revert "Raise OOM error" (#133)
1 parent e6f1077 commit 057926e

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

‎circle.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test:
2020

2121
deployment:
2222
registry:
23-
branch: /master|channel\/[\w-]+/
23+
branch: master
2424
commands:
2525
- >
2626
docker run

‎lib/cc/engine/analyzers/file_thread_pool.rb‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def run(&block)
1616
queue = build_queue
1717
lock = Mutex.new
1818

19-
@workers = Array.new(thread_count) do
20-
with_thread_abortion do
19+
@workers = thread_count.times.map do
20+
Thread.new do
2121
while (item = next_item(queue, lock))
2222
yield item
2323
end
@@ -54,13 +54,6 @@ def thread_count
5454
DEFAULT_CONCURRENCY
5555
end
5656
end
57-
58-
def with_thread_abortion
59-
t = Thread.new do
60-
yield
61-
end
62-
(t.abort_on_exception = true) && t
63-
end
6457
end
6558
end
6659
end

‎spec/cc/engine/analyzers/file_thread_pool_spec.rb‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33

44
RSpec.describe CC::Engine::Analyzers::FileThreadPool do
55
describe "#run" do
6-
let(:thread) { Thread.new {} }
76
it "uses default count of threads when concurrency is not specified" do
8-
allow(Thread).to receive(:new).and_return(thread)
7+
allow(Thread).to receive(:new)
98

109
pool = CC::Engine::Analyzers::FileThreadPool.new([])
1110
pool.run {}
@@ -16,7 +15,7 @@
1615
end
1716

1817
it "uses default concurrency when concurrency is over max" do
19-
allow(Thread).to receive(:new).and_return(thread)
18+
allow(Thread).to receive(:new)
2019

2120
run_pool_with_concurrency(
2221
CC::Engine::Analyzers::FileThreadPool::DEFAULT_CONCURRENCY + 2
@@ -28,7 +27,7 @@
2827
end
2928

3029
it "uses default concucurrency when concucurrency is under 1" do
31-
allow(Thread).to receive(:new).and_return(thread)
30+
allow(Thread).to receive(:new)
3231

3332
run_pool_with_concurrency(-2)
3433

@@ -38,7 +37,7 @@
3837
end
3938

4039
it "uses supplied concurrency when valid" do
41-
allow(Thread).to receive(:new).and_return(thread)
40+
allow(Thread).to receive(:new)
4241

4342
run_pool_with_concurrency(1)
4443

@@ -58,14 +57,6 @@
5857
expect(results).to include("321")
5958
expect(results).to include("zyx")
6059
end
61-
62-
it "aborts on a thread exception" do
63-
allow(Thread).to receive(:new).and_return(thread)
64-
65-
run_pool_with_concurrency(1)
66-
67-
expect(thread.abort_on_exception).to eq(true)
68-
end
6960
end
7061

7162
def run_pool_with_concurrency(concurrency)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /