Repository navigation
Commit 6e2bffa
Fix superfluous SELECT when scheduling a single future job
Execution subclasses use belongs_to :job, which Rails validates by
loading the associated record before each INSERT. For bulk enqueues this
is already avoided via insert_all, but the single-job schedule path
(create_or_find_by!) runs an extra SELECT per job.
Replace the implicit presence-via-association validation with an
explicit column check so the record is only loaded when callers
intentionally traverse the association (e.g. Execution#discard).1 parent 73602fe commit 6e2bffa
2 files changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
90 | 105 | | |
91 | 106 | | |
92 | 107 | | |
| |||
0 commit comments