Skip to content

Commit

Permalink
Merge pull request #288 from grosser/grosser/ga
Browse files Browse the repository at this point in the history
use GA
  • Loading branch information
grosser committed Nov 22, 2020
2 parents 587663e + 56ea12d commit a08cadf
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 47 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/actions.yml
@@ -0,0 +1,23 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql
strategy:
matrix:
ruby: [ '2.5', '2.6', '2.7' ]
name: ${{ matrix.ruby }} rake ${{ matrix.task }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec rake
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

56 changes: 27 additions & 29 deletions spec/cases/map_with_ar.rb
@@ -1,45 +1,43 @@
require './spec/cases/helper'
require "active_record"

Tempfile.open("xxx") do |f|
database = "parallel_with_ar_test"
`mysql #{database} -e '' || mysql -e 'create database #{database}'`
database = "parallel_with_ar_test"
`mysql #{database} -e '' || mysql -e 'create database #{database}'`

ActiveRecord::Schema.verbose = false
ActiveRecord::Base.establish_connection(
:adapter => "mysql2",
:database => database
)
ActiveRecord::Schema.verbose = false
ActiveRecord::Base.establish_connection(
:adapter => "mysql2",
:database => database
)

class User < ActiveRecord::Base
end
class User < ActiveRecord::Base
end

# create tables
unless User.table_exists?
ActiveRecord::Schema.define(:version => 1) do
create_table :users do |t|
t.string :name
end
# create tables
unless User.table_exists?
ActiveRecord::Schema.define(:version => 1) do
create_table :users do |t|
t.string :name
end
end
end

User.delete_all
User.delete_all

User.create!(:name => "X")
User.create!(:name => "X")

Parallel.map(1..8) do |i|
User.create!(:name => i)
end
Parallel.map(1..8) do |i|
User.create!(:name => i)
end

puts "User.count: #{User.count}"
puts "User.count: #{User.count}"

puts User.connection.reconnect!.inspect
puts User.connection.reconnect!.inspect

Parallel.map(1..8, :in_threads => 4) do |i|
User.create!(:name => i)
end
Parallel.map(1..8, :in_threads => 4) do |i|
User.create!(:name => i)
end

User.create!(:name => "X")
User.create!(:name => "X")

puts User.all.map(&:name).sort.join("-")
end
puts User.all.map(&:name).sort.join("-")
2 changes: 1 addition & 1 deletion spec/parallel_spec.rb
Expand Up @@ -189,7 +189,7 @@ def cpus
end

it "does not open unnecessary pipes" do
max = (RbConfig::CONFIG["target_os"].include?("darwin1") ? 10 : 1500) # somehow super bad on travis
max = (RbConfig::CONFIG["target_os"].include?("darwin1") ? 10 : 1800) # somehow super bad on CI
`ruby spec/cases/count_open_pipes.rb`.to_i.should < max
end
end
Expand Down

0 comments on commit a08cadf

Please sign in to comment.