Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix until and while executed and improve documentation #397

Closed
mhenrixon opened this issue Jun 2, 2019 · 1 comment
Closed

Fix until and while executed and improve documentation #397

mhenrixon opened this issue Jun 2, 2019 · 1 comment
Assignees
Milestone

Comments

@mhenrixon
Copy link
Owner

Describe the bug
There are still some issues left with until and while executing. When having simultaneous hits with the same unique digest I see errors that the job could not be unlocked.

Expected behavior
There should be zero warnings logged

Current behavior
Warnings saying couldn't unlock digest: uniquejobs:3e740c8d82ea72148a1261c51457b55b e76f9f956828e37e2295ed32 shows up in the logs

Worker class

class WhileEnqueuedAndBusyJob
  include Sidekiq::Worker

  sidekiq_options lock: :until_and_while_executing,
                  lock_timeout: 10,
                  lock_ttl: nil,
                  lock_limit: 4,
                  on_conflict: :log

  def perform
    SidekiqUniqueJobs.logger.info('jesus')
    sleep 1
    SidekiqUniqueJobs.logger.info('christ')
  end
end

Additional context
When pushing 25 jobs at the same time with 10 available sidekiq workers I can easily replicate the problem.

@mhenrixon mhenrixon self-assigned this Jun 2, 2019
@mhenrixon mhenrixon added the v7.x label Jun 2, 2019
@mhenrixon mhenrixon added this to the V7.0 milestone Jun 2, 2019
@mhenrixon mhenrixon added the bug label Jun 2, 2019
cohakim added a commit to cohakim/kurorekishi.me that referenced this issue Jun 30, 2019
diff --git a/README.md b/README.md
index 1b14006..87cd357 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,14 @@
 ## NEXT

-- ステータス周りを簡易表示
-  - progressbarのエラー
-- deploy メモリ周りを現在の仕様に
-- デザインテンプレート載せ替え
-  - スマホでJS動いてない
-- cloudflare
 - react native / expo
-- make restart 最新のコンテナインスタンスをとり直す / deployしなくても最新のイメージをとってる
+- ロックkey のパージができる
+- S3ライフサイクルの初期化
+- KPI通知
+- ロックが解除されない
+  - mhenrixon/sidekiq-unique-jobs#397
+- ecs-cli 深堀
+  - make restart 最新のコンテナインスタンスをとり直す / deployしなくても最新のイメージをとってる
+- staging 環境作る

 ## 作業ログ

diff --git a/app/frontend/app/controllers/orders_controller.rb b/app/frontend/app/controllers/orders_controller.rb
index 2e60d98..6c40438 100644
--- a/app/frontend/app/controllers/orders_controller.rb
+++ b/app/frontend/app/controllers/orders_controller.rb
@@ -1,9 +1,13 @@
 class OrdersController < ApplicationController
   before_action :welcome_crawler, only: :show
-  before_action :verify_logged_in
-  before_action :verify_active_order_exists, only: :new
-  before_action :verify_active_order_not_exists, only: :show
-  before_action :verify_closing_order_exists, only: :result
+  before_action :require_logged_in
+  before_action :require_active_order_is_non_existent, only: :new
+  before_action :require_active_order_is_existent, only: [:show, :progressbar, :status_dialog]
+  before_action :require_closing_order_is_existent, only: :result
+
+  def new
+    @Form = OrderForm.new(order_params)
+  end

   def show
     @order = find_order.decorate
@@ -16,10 +20,6 @@ class OrdersController < ApplicationController
     @order = find_order.decorate
   end

-  def new
-    @Form = OrderForm.new(order_params)
-  end
-
   def create
     @Form = OrderForm.new(order_params)

@@ -46,7 +46,7 @@ class OrdersController < ApplicationController

   def close
     order = find_order
-    order.close!
+    order.close! if order.may_close?
     redirect_to getstarted_path
   end

@@ -65,36 +65,40 @@ class OrdersController < ApplicationController

   private

-  def welcome_crawler
-    return if current_user.present?
-    render 'roots/show'
-  end
-
   def find_order
     Order.user(current_user).active.first
   end

-  def verify_logged_in
-    redirect_to root_path if current_user.blank?
+  def order_params
+    params.permit(
+      :collect_method, :archive_url,
+      :start_message, :finish_message,
+      :protect_reply, :protect_favorite, :collect_from, :collect_to,
+    ).merge(user_id: current_user.id)
+  end
+
+  def welcome_crawler
+    return if current_user.present?
+    render 'roots/show'
   end

-  def verify_active_order_exists
-    redirect_to order_path if find_order.present?
+  def require_logged_in
+    return if logged_in?
+    redirect_to root_path
   end

-  def verify_active_order_not_exists
-    redirect_to new_order_path unless find_order.present?
+  def require_active_order_is_non_existent
+    return if find_order.blank?
+    redirect_to order_path
   end

-  def verify_closing_order_exists
-    redirect_to order_path unless find_order.closing?
+  def require_active_order_is_existent
+    return if find_order.present?
+    redirect_to new_order_path
   end

-  def order_params
-    params.permit(
-      :collect_method, :archive_url,
-      :start_message, :finish_message,
-      :protect_reply, :protect_favorite, :collect_from, :collect_to,
-    ).merge(user_id: current_user.id)
+  def require_closing_order_is_existent
+    return if find_order.closing?
+    redirect_to order_path
   end
 end
diff --git a/app/frontend/app/views/orders/new/_method.html.haml b/app/frontend/app/views/orders/new/_method.html.haml
index 6e1ec30..7b646c9 100755
--- a/app/frontend/app/views/orders/new/_method.html.haml
+++ b/app/frontend/app/views/orders/new/_method.html.haml
@@ -28,7 +28,6 @@
       %h2.blog-title
         全ツイート履歴
       #twitter-archive-uploader(style='margin-top:20px;')
-        = react_component('Uploader')
       %p
         ダウンロードした<strong>「tweets.zip」</strong>をそのままアップロードしてください<br>
         = link_to usage_path, target: '_blank', style:'text-decoration:underline;' do
diff --git a/build/docker-compose.yml b/build/docker-compose.yml
index 47f89fe..8de706d 100644
--- a/build/docker-compose.yml
+++ b/build/docker-compose.yml
@@ -6,6 +6,7 @@ services:
       dockerfile: build/api/Dockerfile
     image: clean_them_all/api:latest
     container_name: clean_them_all_api
+    env_file: ../.env
     environment:
       RAILS_ENV: production
       RAILS_LOG_TO_STDOUT: 'true'
@@ -21,6 +22,7 @@ services:
       - bundle:/bundle:cached
     depends_on:
       - db
+      - redis
   frontend:
     build:
       context: ../
diff --git a/deployment/Makefile b/deployment/Makefile
index f6e9513..0dc8fde 100644
--- a/deployment/Makefile
+++ b/deployment/Makefile
@@ -16,6 +16,4 @@ setup-cluster:
 	--vpc vpc-0ffee845844d25585 \
 	--subnets subnet-04b4ab206d6625e78,subnet-07588361410320e9c \
 	--security-group sg-031154da5470d733d,sg-04744e60ee6bfb139,sg-01a86733823a315a2 \
-	--instance-role ecsInstanceRole \
-	--keypair default \
-	--force
+	--instance-role ecsInstanceRole
diff --git a/deployment/api/docker-compose.yml b/deployment/api/docker-compose.yml
index 451164d..353caef 100644
--- a/deployment/api/docker-compose.yml
+++ b/deployment/api/docker-compose.yml
@@ -6,6 +6,10 @@ services:
     entrypoint: ["./entrypoint.sh"]
     volumes:
       - bundle:/bundle:cached
+    entrypoint: ["./entrypoint.sh"]
+    command: ["rails", "server", "-b", "0.0.0.0"]
+    ports:
+      - '3000'
     logging:
       driver: awslogs
       options:
diff --git a/deployment/api/ecs-params.yml b/deployment/api/ecs-params.yml
index 4848b28..54341a6 100644
--- a/deployment/api/ecs-params.yml
+++ b/deployment/api/ecs-params.yml
@@ -2,9 +2,9 @@ version: 1
 task_definition:
   ecs_network_mode: bridge
   task_execution_role: ecsTaskExecutionRole
-  task_size:
-    cpu_limit: 512
-    mem_limit: 512
   services:
     app:
       essential: true
+      cpu_shares: 500
+      mem_limit: 500m
+      mem_reservation: 500m
diff --git a/deployment/backend/ecs-params.yml b/deployment/backend/ecs-params.yml
index 7d14b2d..d533f05 100644
--- a/deployment/backend/ecs-params.yml
+++ b/deployment/backend/ecs-params.yml
@@ -5,9 +5,9 @@ task_definition:
   services:
     backend:
       essential: true
-      cpu_shares: 1024
-      mem_limit: 1955m
-      mem_reservation: 512m
+      cpu_shares: 2048
+      mem_limit: 1500m
+      mem_reservation: 1500m
       healthcheck:
         test: "ps ax | grep -v grep | grep sidekiq > /dev/null"
         interval: 5s
diff --git a/deployment/frontend/ecs-params.yml b/deployment/frontend/ecs-params.yml
index b77209a..57ca5bc 100644
--- a/deployment/frontend/ecs-params.yml
+++ b/deployment/frontend/ecs-params.yml
@@ -5,5 +5,6 @@ task_definition:
   services:
     frontend:
       essential: true
-      cpu_shares: 1024
-      mem_reservation: 512m
+      cpu_shares: 500
+      mem_limit: 500m
+      mem_reservation: 500m
cohakim added a commit to cohakim/kurorekishi.me that referenced this issue Jun 30, 2019
diff --git a/README.md b/README.md
index 1b14006..87cd357 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,14 @@
 ## NEXT

-- ステータス周りを簡易表示
-  - progressbarのエラー
-- deploy メモリ周りを現在の仕様に
-- デザインテンプレート載せ替え
-  - スマホでJS動いてない
-- cloudflare
 - react native / expo
-- make restart 最新のコンテナインスタンスをとり直す / deployしなくても最新のイメージをとってる
+- ロックkey のパージができる
+- S3ライフサイクルの初期化
+- KPI通知
+- ロックが解除されない
+  - mhenrixon/sidekiq-unique-jobs#397
+- ecs-cli 深堀
+  - make restart 最新のコンテナインスタンスをとり直す / deployしなくても最新のイメージをとってる
+- staging 環境作る

 ## 作業ログ

diff --git a/app/frontend/app/controllers/orders_controller.rb b/app/frontend/app/controllers/orders_controller.rb
index 2e60d98..6c40438 100644
--- a/app/frontend/app/controllers/orders_controller.rb
+++ b/app/frontend/app/controllers/orders_controller.rb
@@ -1,9 +1,13 @@
 class OrdersController < ApplicationController
   before_action :welcome_crawler, only: :show
-  before_action :verify_logged_in
-  before_action :verify_active_order_exists, only: :new
-  before_action :verify_active_order_not_exists, only: :show
-  before_action :verify_closing_order_exists, only: :result
+  before_action :require_logged_in
+  before_action :require_active_order_is_non_existent, only: :new
+  before_action :require_active_order_is_existent, only: [:show, :progressbar, :status_dialog]
+  before_action :require_closing_order_is_existent, only: :result
+
+  def new
+    @Form = OrderForm.new(order_params)
+  end

   def show
     @order = find_order.decorate
@@ -16,10 +20,6 @@ class OrdersController < ApplicationController
     @order = find_order.decorate
   end

-  def new
-    @Form = OrderForm.new(order_params)
-  end
-
   def create
     @Form = OrderForm.new(order_params)

@@ -46,7 +46,7 @@ class OrdersController < ApplicationController

   def close
     order = find_order
-    order.close!
+    order.close! if order.may_close?
     redirect_to getstarted_path
   end

@@ -65,36 +65,40 @@ class OrdersController < ApplicationController

   private

-  def welcome_crawler
-    return if current_user.present?
-    render 'roots/show'
-  end
-
   def find_order
     Order.user(current_user).active.first
   end

-  def verify_logged_in
-    redirect_to root_path if current_user.blank?
+  def order_params
+    params.permit(
+      :collect_method, :archive_url,
+      :start_message, :finish_message,
+      :protect_reply, :protect_favorite, :collect_from, :collect_to,
+    ).merge(user_id: current_user.id)
+  end
+
+  def welcome_crawler
+    return if current_user.present?
+    render 'roots/show'
   end

-  def verify_active_order_exists
-    redirect_to order_path if find_order.present?
+  def require_logged_in
+    return if logged_in?
+    redirect_to root_path
   end

-  def verify_active_order_not_exists
-    redirect_to new_order_path unless find_order.present?
+  def require_active_order_is_non_existent
+    return if find_order.blank?
+    redirect_to order_path
   end

-  def verify_closing_order_exists
-    redirect_to order_path unless find_order.closing?
+  def require_active_order_is_existent
+    return if find_order.present?
+    redirect_to new_order_path
   end

-  def order_params
-    params.permit(
-      :collect_method, :archive_url,
-      :start_message, :finish_message,
-      :protect_reply, :protect_favorite, :collect_from, :collect_to,
-    ).merge(user_id: current_user.id)
+  def require_closing_order_is_existent
+    return if find_order.closing?
+    redirect_to order_path
   end
 end
diff --git a/app/frontend/app/views/orders/new/_method.html.haml b/app/frontend/app/views/orders/new/_method.html.haml
index 6e1ec30..7b646c9 100755
--- a/app/frontend/app/views/orders/new/_method.html.haml
+++ b/app/frontend/app/views/orders/new/_method.html.haml
@@ -28,7 +28,6 @@
       %h2.blog-title
         全ツイート履歴
       #twitter-archive-uploader(style='margin-top:20px;')
-        = react_component('Uploader')
       %p
         ダウンロードした<strong>「tweets.zip」</strong>をそのままアップロードしてください<br>
         = link_to usage_path, target: '_blank', style:'text-decoration:underline;' do
diff --git a/build/docker-compose.yml b/build/docker-compose.yml
index 47f89fe..8de706d 100644
--- a/build/docker-compose.yml
+++ b/build/docker-compose.yml
@@ -6,6 +6,7 @@ services:
       dockerfile: build/api/Dockerfile
     image: clean_them_all/api:latest
     container_name: clean_them_all_api
+    env_file: ../.env
     environment:
       RAILS_ENV: production
       RAILS_LOG_TO_STDOUT: 'true'
@@ -21,6 +22,7 @@ services:
       - bundle:/bundle:cached
     depends_on:
       - db
+      - redis
   frontend:
     build:
       context: ../
diff --git a/deployment/Makefile b/deployment/Makefile
index f6e9513..0dc8fde 100644
--- a/deployment/Makefile
+++ b/deployment/Makefile
@@ -16,6 +16,4 @@ setup-cluster:
 	--vpc vpc-0ffee845844d25585 \
 	--subnets subnet-04b4ab206d6625e78,subnet-07588361410320e9c \
 	--security-group sg-031154da5470d733d,sg-04744e60ee6bfb139,sg-01a86733823a315a2 \
-	--instance-role ecsInstanceRole \
-	--keypair default \
-	--force
+	--instance-role ecsInstanceRole
diff --git a/deployment/api/docker-compose.yml b/deployment/api/docker-compose.yml
index 451164d..353caef 100644
--- a/deployment/api/docker-compose.yml
+++ b/deployment/api/docker-compose.yml
@@ -6,6 +6,10 @@ services:
     entrypoint: ["./entrypoint.sh"]
     volumes:
       - bundle:/bundle:cached
+    entrypoint: ["./entrypoint.sh"]
+    command: ["rails", "server", "-b", "0.0.0.0"]
+    ports:
+      - '3000'
     logging:
       driver: awslogs
       options:
diff --git a/deployment/api/ecs-params.yml b/deployment/api/ecs-params.yml
index 4848b28..54341a6 100644
--- a/deployment/api/ecs-params.yml
+++ b/deployment/api/ecs-params.yml
@@ -2,9 +2,9 @@ version: 1
 task_definition:
   ecs_network_mode: bridge
   task_execution_role: ecsTaskExecutionRole
-  task_size:
-    cpu_limit: 512
-    mem_limit: 512
   services:
     app:
       essential: true
+      cpu_shares: 500
+      mem_limit: 500m
+      mem_reservation: 500m
diff --git a/deployment/backend/ecs-params.yml b/deployment/backend/ecs-params.yml
index 7d14b2d..d533f05 100644
--- a/deployment/backend/ecs-params.yml
+++ b/deployment/backend/ecs-params.yml
@@ -5,9 +5,9 @@ task_definition:
   services:
     backend:
       essential: true
-      cpu_shares: 1024
-      mem_limit: 1955m
-      mem_reservation: 512m
+      cpu_shares: 2048
+      mem_limit: 1500m
+      mem_reservation: 1500m
       healthcheck:
         test: "ps ax | grep -v grep | grep sidekiq > /dev/null"
         interval: 5s
diff --git a/deployment/frontend/ecs-params.yml b/deployment/frontend/ecs-params.yml
index b77209a..57ca5bc 100644
--- a/deployment/frontend/ecs-params.yml
+++ b/deployment/frontend/ecs-params.yml
@@ -5,5 +5,6 @@ task_definition:
   services:
     frontend:
       essential: true
-      cpu_shares: 1024
-      mem_reservation: 512m
+      cpu_shares: 500
+      mem_limit: 500m
+      mem_reservation: 500m
cohakim added a commit to cohakim/kurorekishi.me that referenced this issue Jun 30, 2019
diff --git a/README.md b/README.md
index 6aefb88..0a920e1 100644
--- a/README.md
+++ b/README.md
@@ -3,11 +3,5 @@
 ## NEXT

 - react native / expo
-- ロックkey のパージができる
-- S3ライフサイクルの初期化
-- KPI通知
-- ロックが解除されない
-  - mhenrixon/sidekiq-unique-jobs#397
 - ecs-cli 深堀
   - make restart 最新のコンテナインスタンスをとり直す / deployしなくても最新のイメージをとってる
-- staging 環境作る
diff --git a/app/api/Gemfile.lock b/app/api/Gemfile.lock
index ec21efc..0b1f9cb 100644
--- a/app/api/Gemfile.lock
+++ b/app/api/Gemfile.lock
@@ -6,7 +6,7 @@ PATH
 GEM
   remote: https://rubygems.org/
   specs:
-    aasm (5.0.3)
+    aasm (5.0.5)
       concurrent-ruby (~> 1.0)
     actioncable (5.2.3)
       actionpack (= 5.2.3)
@@ -65,19 +65,19 @@ GEM
     ast (2.4.0)
     awesome_print (1.8.0)
     aws-eventstream (1.0.3)
-    aws-partitions (1.158.0)
-    aws-sdk-core (3.49.0)
+    aws-partitions (1.182.0)
+    aws-sdk-core (3.57.0)
       aws-eventstream (~> 1.0, >= 1.0.2)
       aws-partitions (~> 1.0)
       aws-sigv4 (~> 1.1)
       jmespath (~> 1.0)
-    aws-sdk-kms (1.18.0)
-      aws-sdk-core (~> 3, >= 3.48.2)
+    aws-sdk-kms (1.22.0)
+      aws-sdk-core (~> 3, >= 3.56.0)
       aws-sigv4 (~> 1.1)
-    aws-sdk-s3 (1.36.1)
-      aws-sdk-core (~> 3, >= 3.48.2)
+    aws-sdk-s3 (1.43.0)
+      aws-sdk-core (~> 3, >= 3.56.0)
       aws-sdk-kms (~> 1)
-      aws-sigv4 (~> 1.0)
+      aws-sigv4 (~> 1.1)
     aws-sigv4 (1.1.0)
       aws-eventstream (~> 1.0, >= 1.0.2)
     axiom-types (0.1.1)
@@ -90,7 +90,7 @@ GEM
     bugsnag (6.11.1)
       concurrent-ruby (~> 1.0)
     builder (3.2.3)
-    bullet (6.0.0)
+    bullet (6.0.1)
       activesupport (>= 3.0.0)
       uniform_notifier (~> 1.11)
     byebug (11.0.1)
@@ -101,6 +101,7 @@ GEM
       descendants_tracker (~> 0.0.1)
     concurrent-ruby (1.1.5)
     configatron (4.5.1)
+    connection_pool (2.2.2)
     crack (0.4.3)
       safe_yaml (~> 1.0.0)
     crass (1.0.4)
@@ -110,17 +111,17 @@ GEM
     diffy (3.3.0)
     domain_name (0.5.20180417)
       unf (>= 0.0.5, < 1.0.0)
-    dry-configurable (0.8.2)
+    dry-configurable (0.8.3)
       concurrent-ruby (~> 1.0)
       dry-core (~> 0.4, >= 0.4.7)
-    dry-container (0.7.0)
+    dry-container (0.7.1)
       concurrent-ruby (~> 1.0)
       dry-configurable (~> 0.1, >= 0.1.3)
-    dry-core (0.4.7)
+    dry-core (0.4.8)
       concurrent-ruby (~> 1.0)
     dry-equalizer (0.2.2)
     dry-inflector (0.1.2)
-    dry-logic (1.0.0)
+    dry-logic (1.0.2)
       concurrent-ruby (~> 1.0)
       dry-core (~> 0.2)
       dry-equalizer (~> 0.2)
@@ -129,7 +130,7 @@ GEM
       dry-equalizer (~> 0.2)
       dry-types (~> 1.0)
       ice_nine (~> 0.11)
-    dry-types (1.0.0)
+    dry-types (1.0.1)
       concurrent-ruby (~> 1.0)
       dry-container (~> 0.3)
       dry-core (~> 0.4, >= 0.4.4)
@@ -138,6 +139,8 @@ GEM
       dry-logic (~> 1.0)
     equalizer (0.0.11)
     erubi (1.8.0)
+    et-orbi (1.2.1)
+      tzinfo
     factory_bot (5.0.2)
       activesupport (>= 4.2.0)
     factory_bot_rails (5.0.2)
@@ -145,12 +148,17 @@ GEM
       railties (>= 4.2.0)
     faker (1.9.3)
       i18n (>= 0.7)
-    ffi (1.10.0)
+    fakeredis (0.7.0)
+      redis (>= 3.2, < 5.0)
+    ffi (1.11.1)
     foreman (0.85.0)
       thor (~> 0.19.1)
+    fugit (1.2.2)
+      et-orbi (~> 1.1, >= 1.1.8)
+      raabro (~> 1.1)
     globalid (0.4.2)
       activesupport (>= 4.2.0)
-    hashdiff (0.3.9)
+    hashdiff (0.4.0)
     http (3.3.0)
       addressable (~> 2.3)
       http-cookie (~> 1.0)
@@ -162,13 +170,13 @@ GEM
     http_parser.rb (0.6.0)
     i18n (1.6.0)
       concurrent-ruby (~> 1.0)
-    i18n_generators (2.2.1)
+    i18n_generators (2.2.2)
       activerecord (>= 3.0.0)
       railties (>= 3.0.0)
     ice_nine (0.11.2)
-    jaro_winkler (1.5.2)
+    jaro_winkler (1.5.3)
     jmespath (1.4.0)
-    jsonapi-renderer (0.2.0)
+    jsonapi-renderer (0.2.2)
     listen (3.1.5)
       rb-fsevent (~> 0.9, >= 0.9.4)
       rb-inotify (~> 0.9, >= 0.9.7)
@@ -187,8 +195,8 @@ GEM
     mini_mime (1.0.1)
     mini_portile2 (2.4.0)
     minitest (5.11.3)
-    msgpack (1.2.10)
-    multipart-post (2.1.0)
+    msgpack (1.3.0)
+    multipart-post (2.1.1)
     mysql2 (0.5.2)
     naught (1.1.0)
     nio4r (2.3.1)
@@ -208,9 +216,12 @@ GEM
       pry (~> 0.10)
     pry-rails (0.3.9)
       pry (>= 0.10.4)
-    public_suffix (3.0.3)
+    public_suffix (3.1.1)
     puma (3.12.1)
+    raabro (1.1.6)
     rack (2.0.7)
+    rack-protection (2.0.5)
+      rack
     rack-test (1.1.0)
       rack (>= 1.0, < 3)
     rails (5.2.3)
@@ -246,6 +257,7 @@ GEM
     rb-fsevent (0.10.3)
     rb-inotify (0.10.0)
       ffi (~> 1.0)
+    redis (4.1.2)
     retryable (3.0.4)
     ridgepole (0.7.7)
       activerecord (>= 5.0.1, < 6)
@@ -254,12 +266,12 @@ GEM
       rspec-core (~> 3.8.0)
       rspec-expectations (~> 3.8.0)
       rspec-mocks (~> 3.8.0)
-    rspec-core (3.8.0)
+    rspec-core (3.8.2)
       rspec-support (~> 3.8.0)
-    rspec-expectations (3.8.3)
+    rspec-expectations (3.8.4)
       diff-lcs (>= 1.2.0, < 2.0)
       rspec-support (~> 3.8.0)
-    rspec-mocks (3.8.0)
+    rspec-mocks (3.8.1)
       diff-lcs (>= 1.2.0, < 2.0)
       rspec-support (~> 3.8.0)
     rspec-rails (3.8.2)
@@ -270,20 +282,35 @@ GEM
       rspec-expectations (~> 3.8.0)
       rspec-mocks (~> 3.8.0)
       rspec-support (~> 3.8.0)
-    rspec-support (3.8.0)
-    rubocop (0.68.1)
+    rspec-support (3.8.2)
+    rubocop (0.72.0)
       jaro_winkler (~> 1.5.1)
       parallel (~> 1.10)
-      parser (>= 2.5, != 2.5.1.1)
+      parser (>= 2.6)
       rainbow (>= 2.2.2, < 4.0)
       ruby-progressbar (~> 1.7)
-      unicode-display_width (>= 1.4.0, < 1.6)
-    ruby-progressbar (1.10.0)
+      unicode-display_width (>= 1.4.0, < 1.7)
+    ruby-progressbar (1.10.1)
     ruby_dep (1.5.0)
+    rufus-scheduler (3.6.0)
+      fugit (~> 1.1, >= 1.1.6)
     safe_yaml (1.0.5)
+    sidekiq (5.2.7)
+      connection_pool (~> 2.2, >= 2.2.2)
+      rack (>= 1.5.0)
+      rack-protection (>= 1.5.0)
+      redis (>= 3.3.5, < 5)
+    sidekiq-scheduler (3.0.0)
+      redis (>= 3, < 5)
+      rufus-scheduler (~> 3.2)
+      sidekiq (>= 3)
+      tilt (>= 1.4.0)
+    sidekiq-unique-jobs (6.0.13)
+      concurrent-ruby (~> 1.0, >= 1.0.5)
+      sidekiq (>= 4.0, < 7.0)
+      thor (~> 0)
     simple_oauth (0.3.1)
-    spring (2.0.2)
-      activesupport (>= 4.2)
+    spring (2.1.0)
     spring-commands-rspec (1.0.4)
       spring (>= 0.9.1)
     spring-watcher-listen (2.0.1)
@@ -298,6 +325,7 @@ GEM
       sprockets (>= 3.0.0)
     thor (0.19.4)
     thread_safe (0.3.6)
+    tilt (2.0.9)
     twitter (6.2.0)
       addressable (~> 2.3)
       buftok (~> 0.2.0)
@@ -314,20 +342,20 @@ GEM
     unf (0.1.4)
       unf_ext
     unf_ext (0.0.7.6)
-    unicode-display_width (1.5.0)
+    unicode-display_width (1.6.0)
     uniform_notifier (1.12.1)
     virtus (1.0.5)
       axiom-types (~> 0.1)
       coercible (~> 1.0)
       descendants_tracker (~> 0.0, >= 0.0.3)
       equalizer (~> 0.0, >= 0.0.9)
-    webmock (3.5.1)
+    webmock (3.6.0)
       addressable (>= 2.3.6)
       crack (>= 0.3.2)
-      hashdiff
-    websocket-driver (0.7.0)
+      hashdiff (>= 0.4.0, < 2.0.0)
+    websocket-driver (0.7.1)
       websocket-extensions (>= 0.1.0)
-    websocket-extensions (0.1.3)
+    websocket-extensions (0.1.4)

 PLATFORMS
   ruby
@@ -348,6 +376,7 @@ DEPENDENCIES
   dry-types
   factory_bot_rails
   faker
+  fakeredis
   foreman
   i18n_generators
   listen (>= 3.0.5, < 3.2)
@@ -364,6 +393,9 @@ DEPENDENCIES
   rspec-rails
   rubocop
   shared!
+  sidekiq
+  sidekiq-scheduler
+  sidekiq-unique-jobs
   spring
   spring-commands-rspec
   spring-watcher-listen (~> 2.0.0)
diff --git a/app/api/Procfile b/app/api/Procfile
new file mode 100644
index 0000000..4bc1096
--- /dev/null
+++ b/app/api/Procfile
@@ -0,0 +1 @@
+puma: bundle exec rails s -b 0.0.0.0 -p 3000
diff --git a/app/api/app/serializers/order_serializer.rb b/app/api/app/serializers/order_serializer.rb
index b7483d4..cfdab4e 100644
--- a/app/api/app/serializers/order_serializer.rb
+++ b/app/api/app/serializers/order_serializer.rb
@@ -1,3 +1,30 @@
+# == Schema Information
+#
+# Table name: orders
+#
+#  id                      :bigint           not null, primary key
+#  user_id                 :bigint           not null
+#  transition_state        :integer          not null
+#  progression_state       :integer          not null
+#  collect_count           :integer          default(0), not null
+#  destroy_count           :integer          default(0), not null
+#  processed_at            :datetime
+#  confirmed_at            :datetime
+#  closed_at               :datetime
+#  collected_at            :datetime
+#  destroyed_at            :datetime
+#  start_message_notified  :boolean          default(FALSE), not null
+#  finish_message_notified :boolean          default(FALSE), not null
+#  created_at              :datetime         not null
+#  updated_at              :datetime         not null
+#
+# Indexes
+#
+#  index_orders_on_progression_state  (progression_state)
+#  index_orders_on_transition_state   (transition_state)
+#  index_orders_on_user_id            (user_id)
+#
+
 class OrderSerializer < ActiveModel::Serializer
   attributes :id

diff --git a/app/api/app/serializers/parameter_serializer.rb b/app/api/app/serializers/parameter_serializer.rb
index 8a05ba7..667cafc 100644
--- a/app/api/app/serializers/parameter_serializer.rb
+++ b/app/api/app/serializers/parameter_serializer.rb
@@ -1,3 +1,26 @@
+# == Schema Information
+#
+# Table name: parameters
+#
+#  id               :bigint           not null, primary key
+#  order_id         :bigint           not null
+#  signedin_at      :datetime         not null
+#  collect_method   :integer          not null
+#  archive_url      :text(65535)
+#  protect_reply    :boolean          default(FALSE), not null
+#  protect_favorite :boolean          default(FALSE), not null
+#  collect_from     :date
+#  collect_to       :date
+#  start_message    :text(65535)
+#  finish_message   :text(65535)
+#  created_at       :datetime         not null
+#  updated_at       :datetime         not null
+#
+# Indexes
+#
+#  index_parameters_on_order_id  (order_id) UNIQUE
+#
+
 class ParameterSerializer < ActiveModel::Serializer
   attributes %i(
     order_id
diff --git a/app/api/app/serializers/user_serializer.rb b/app/api/app/serializers/user_serializer.rb
index 4dacc37..5750352 100644
--- a/app/api/app/serializers/user_serializer.rb
+++ b/app/api/app/serializers/user_serializer.rb
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: users
+#
+#  id         :bigint           not null, primary key
+#  token      :string(255)      not null
+#  secret     :string(255)      not null
+#  name       :string(255)
+#  created_at :datetime         not null
+#  updated_at :datetime         not null
+#
+
 class UserSerializer < ActiveModel::Serializer
   attribute :id

diff --git a/app/api/bin/spring b/app/api/bin/spring
index fb2ec2e..d89ee49 100755
--- a/app/api/bin/spring
+++ b/app/api/bin/spring
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby

-# This file loads spring without using Bundler, in order to be fast.
+# This file loads Spring without using Bundler, in order to be fast.
 # It gets overwritten when you run the `spring binstub` command.

 unless defined?(Spring)
@@ -8,7 +8,7 @@ unless defined?(Spring)
   require 'bundler'

   lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
-  spring = lockfile.specs.detect { |spec| spec.name == "spring" }
+  spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
   if spring
     Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
     gem 'spring', spring.version
diff --git a/app/api/config/application.rb b/app/api/config/application.rb
index c227784..e0c1158 100644
--- a/app/api/config/application.rb
+++ b/app/api/config/application.rb
@@ -10,6 +10,7 @@ module API
     config.api_only = true

     # paths
+    config.paths.add 'config/database', with: Shared::Engine.root.join('config', 'database.yml')
     config.active_storage.service_configurations = begin
       config_file = Pathname.new(Shared::Engine.root.join("config/storage.yml"))
       YAML.load(ERB.new(config_file.read).result) || {}
@mhenrixon
Copy link
Owner Author

This has been fixed over several individual PRs and I can't replicate this problem anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant