Offload tracking onboarding progress to worker
What does this MR do?
This offloads the recording of the onboarding progress to a worker, to prevent writing to the database inside an endpoint.
Also, this fixes a bug introduced in this MR where we recorded the wrong action (git_read
instead of git_pull
).
I created a followup issue here to refactor existing workers that call the OnboardingProgressService
to the more generic worker introduced here and change the RSpec shared example records an onboarding progress action
to prevent this bug from happening again and actually test the recorded value instead of using stubs.
Queries
ActiveRecord
OnboardingProgress.where(namespace_id: 10846940, git_pull_at: nil).exists?
SQL
SELECT
1 AS one
FROM
"onboarding_progresses"
WHERE
"onboarding_progresses"."namespace_id" = 10846940
AND "onboarding_progresses"."git_pull_at" IS NULL
LIMIT
1
postgres.ai)
Query Plan ( Limit (cost=0.29..3.31 rows=1 width=4) (actual time=3.260..3.261 rows=1 loops=1)
Buffers: shared hit=4 read=2
I/O Timings: read=3.178
-> Index Scan using index_onboarding_progresses_on_namespace_id on public.onboarding_progresses (cost=0.29..3.31 rows=1 width=4) (actual time=3.256..3.257 rows=1 loops=1)
Index Cond: (onboarding_progresses.namespace_id = 10846940)
Filter: (onboarding_progresses.git_pull_at IS NULL)
Rows Removed by Filter: 0
Buffers: shared hit=4 read=2
I/O Timings: read=3.178
Since this is a non-user facing change, no changelog was added.
Edited by Alex Buijs