db_background_job 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d5b8658d5c052991d3745f3eb96e1eacb75bd9439f7e5d758fa9379706bd6fe5
4
+ data.tar.gz: ad0b1a557af683c0964e022695ca55be0773d68b0d052f4668be23d4d1ba8fb4
5
+ SHA512:
6
+ metadata.gz: 8e4c4a8ec1cc3d22be4468f594291cf18dbf065bf702feb1b71fb0682279eabd9aa58ba985ced87c58c907d8da8f4584f46a6c47aee819d502a1a7b5cabd1e84
7
+ data.tar.gz: c62e1a3facd4fd189cec53f5be4e5a1390a163824aab8979b7db5a19a68a33356f164aca2b8b16fd3f56ea20ee43d3aa4f7f99e3c595067e44e88eb8c747e612
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build db_background_job-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeGroup description="" fullCmd="" taksId="build"><RakeTask description="Generate SHA512 checksum of db_background_job-0.1.0.gem into the checksums directory" fullCmd="build:checksum" taksId="checksum" /></RakeGroup><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install db_background_job-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install db_background_job-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push db_background_job-0.1.0.gem to TODO: Set to your gem server 'https://example.com'" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$" />
8
+ <orderEntry type="inheritedJdk" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ <orderEntry type="library" scope="PROVIDED" name="activemodel (v7.0.4, RVM: ruby-3.0.2) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="activerecord (v7.0.4, RVM: ruby-3.0.2) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v7.0.4, RVM: ruby-3.0.2) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.5.23, RVM: ruby-3.0.2) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.10, RVM: ruby-3.0.2) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-3.0.2) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.12.0, RVM: ruby-3.0.2) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.16.3, RVM: ruby-3.0.2) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.1.0, RVM: ruby-3.0.2) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.12.0, RVM: ruby-3.0.2) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.12.2, RVM: ruby-3.0.2) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.12.3, RVM: ruby-3.0.2) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.12.6, RVM: ruby-3.0.2) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.12.1, RVM: ruby-3.0.2) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.5, RVM: ruby-3.0.2) [gem]" level="application" />
25
+ </component>
26
+ </module>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
+ </project>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
5
+ </profile>
6
+ </component>
data/.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-3.0.2" project-jdk-type="RUBY_SDK" />
7
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/db_background_job.iml" filepath="$PROJECT_DIR$/.idea/db_background_job.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,384 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="5cf63fcd-2b4f-4272-a6ff-051bfaa035f7" name="Default Changelist" comment="">
5
+ <change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
6
+ <change afterPath="$PROJECT_DIR$/.idea/.rakeTasks" afterDir="false" />
7
+ <change afterPath="$PROJECT_DIR$/.idea/db_background_job.iml" afterDir="false" />
8
+ <change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
9
+ <change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
10
+ <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
11
+ <change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
12
+ <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
13
+ <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
14
+ <change afterPath="$PROJECT_DIR$/.rspec" afterDir="false" />
15
+ <change afterPath="$PROJECT_DIR$/Gemfile" afterDir="false" />
16
+ <change afterPath="$PROJECT_DIR$/LICENSE.txt" afterDir="false" />
17
+ <change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
18
+ <change afterPath="$PROJECT_DIR$/Rakefile" afterDir="false" />
19
+ <change afterPath="$PROJECT_DIR$/db_background_job.gemspec" afterDir="false" />
20
+ <change afterPath="$PROJECT_DIR$/lib/db_background_job.rb" afterDir="false" />
21
+ <change afterPath="$PROJECT_DIR$/lib/db_background_job/version.rb" afterDir="false" />
22
+ <change afterPath="$PROJECT_DIR$/sig/db_background_job.rbs" afterDir="false" />
23
+ <change afterPath="$PROJECT_DIR$/spec/config/database.yml" afterDir="false" />
24
+ <change afterPath="$PROJECT_DIR$/spec/db_background_job_spec.rb" afterDir="false" />
25
+ <change afterPath="$PROJECT_DIR$/spec/spec_helper.rb" afterDir="false" />
26
+ </list>
27
+ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
28
+ <option name="SHOW_DIALOG" value="false" />
29
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
30
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
31
+ <option name="LAST_RESOLUTION" value="IGNORE" />
32
+ </component>
33
+ <component name="CoverageDataManager">
34
+ <SUITE FILE_PATH="coverage/db_background_job@DbBackgroundJob__db_background_job.rcov" NAME="DbBackgroundJob: db_background_job Coverage Results" MODIFIED="1735516429089" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="db_background_job" />
35
+ </component>
36
+ <component name="FileEditorManager">
37
+ <leaf>
38
+ <file pinned="false" current-in-tab="false">
39
+ <entry file="file://$PROJECT_DIR$/lib/db_background_job.rb">
40
+ <provider selected="true" editor-type-id="text-editor">
41
+ <state relative-caret-position="119">
42
+ <caret line="7" column="11" selection-start-line="7" selection-start-column="11" selection-end-line="7" selection-end-column="11" />
43
+ </state>
44
+ </provider>
45
+ </entry>
46
+ </file>
47
+ <file pinned="false" current-in-tab="false">
48
+ <entry file="file://$PROJECT_DIR$/.rspec">
49
+ <provider selected="true" editor-type-id="text-editor" />
50
+ </entry>
51
+ </file>
52
+ <file pinned="false" current-in-tab="false">
53
+ <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
54
+ <provider selected="true" editor-type-id="text-editor">
55
+ <state relative-caret-position="204">
56
+ <caret line="12" column="1" selection-start-line="12" selection-start-column="1" selection-end-line="12" selection-end-column="1" />
57
+ </state>
58
+ </provider>
59
+ </entry>
60
+ </file>
61
+ <file pinned="false" current-in-tab="true">
62
+ <entry file="file://$PROJECT_DIR$/spec/db_background_job_spec.rb">
63
+ <provider selected="true" editor-type-id="text-editor">
64
+ <state relative-caret-position="374">
65
+ <caret line="22" column="64" lean-forward="true" selection-start-line="22" selection-start-column="64" selection-end-line="22" selection-end-column="64" />
66
+ </state>
67
+ </provider>
68
+ </entry>
69
+ </file>
70
+ <file pinned="false" current-in-tab="false">
71
+ <entry file="file://$PROJECT_DIR$/README.md">
72
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
73
+ <state split_layout="SPLIT">
74
+ <first_editor relative-caret-position="323">
75
+ <caret line="28" column="29" lean-forward="true" selection-start-line="28" selection-start-column="29" selection-end-line="28" selection-end-column="29" />
76
+ </first_editor>
77
+ <second_editor />
78
+ </state>
79
+ </provider>
80
+ </entry>
81
+ </file>
82
+ <file pinned="false" current-in-tab="false">
83
+ <entry file="file://$USER_HOME$/.rvm/gems/ruby-3.0.2/gems/activesupport-7.0.4/lib/active_support/log_subscriber.rb">
84
+ <provider selected="true" editor-type-id="text-editor">
85
+ <state relative-caret-position="280">
86
+ <caret line="126" column="28" selection-start-line="126" selection-start-column="23" selection-end-line="126" selection-end-column="28" />
87
+ </state>
88
+ </provider>
89
+ </entry>
90
+ </file>
91
+ <file pinned="false" current-in-tab="false">
92
+ <entry file="file://$USER_HOME$/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/bundler/ui/shell.rb">
93
+ <provider selected="true" editor-type-id="text-editor">
94
+ <state relative-caret-position="374">
95
+ <caret line="22" column="10" selection-start-line="22" selection-start-column="10" selection-end-line="22" selection-end-column="10" />
96
+ </state>
97
+ </provider>
98
+ </entry>
99
+ </file>
100
+ <file pinned="false" current-in-tab="false">
101
+ <entry file="file://$PROJECT_DIR$/db_background_job.gemspec">
102
+ <provider selected="true" editor-type-id="text-editor">
103
+ <state relative-caret-position="187">
104
+ <caret line="11" column="183" lean-forward="true" selection-start-line="11" selection-start-column="22" selection-end-line="11" selection-end-column="183" />
105
+ </state>
106
+ </provider>
107
+ </entry>
108
+ </file>
109
+ </leaf>
110
+ </component>
111
+ <component name="Git.Settings">
112
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
113
+ </component>
114
+ <component name="IdeDocumentHistory">
115
+ <option name="CHANGED_PATHS">
116
+ <list>
117
+ <option value="$PROJECT_DIR$/lib/db_background_job.rb" />
118
+ <option value="$PROJECT_DIR$/spec/config/database.yml" />
119
+ <option value="$PROJECT_DIR$/spec/spec_helper.rb" />
120
+ <option value="$PROJECT_DIR$/db_background_job.gemspec" />
121
+ <option value="$PROJECT_DIR$/README.md" />
122
+ <option value="$PROJECT_DIR$/spec/db_background_job_spec.rb" />
123
+ </list>
124
+ </option>
125
+ </component>
126
+ <component name="JsFlowSettings">
127
+ <service-enabled>true</service-enabled>
128
+ <exe-path />
129
+ <other-services-enabled>true</other-services-enabled>
130
+ <auto-save>true</auto-save>
131
+ </component>
132
+ <component name="ProjectFrameBounds" extendedState="6">
133
+ <option name="x" value="3840" />
134
+ <option name="width" value="1920" />
135
+ <option name="height" value="1080" />
136
+ </component>
137
+ <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
138
+ <component name="ProjectView">
139
+ <navigator proportions="" version="1">
140
+ <foldersAlwaysOnTop value="true" />
141
+ </navigator>
142
+ <panes>
143
+ <pane id="Scope" />
144
+ <pane id="ProjectPane">
145
+ <subPane>
146
+ <expand>
147
+ <path>
148
+ <item name="db_background_job" type="b2602c69:ProjectViewProjectNode" />
149
+ <item name="db_background_job" type="462c0819:PsiDirectoryNode" />
150
+ </path>
151
+ <path>
152
+ <item name="db_background_job" type="b2602c69:ProjectViewProjectNode" />
153
+ <item name="db_background_job" type="462c0819:PsiDirectoryNode" />
154
+ <item name="lib" type="462c0819:PsiDirectoryNode" />
155
+ </path>
156
+ <path>
157
+ <item name="db_background_job" type="b2602c69:ProjectViewProjectNode" />
158
+ <item name="db_background_job" type="462c0819:PsiDirectoryNode" />
159
+ <item name="lib" type="462c0819:PsiDirectoryNode" />
160
+ <item name="db_background_job" type="462c0819:PsiDirectoryNode" />
161
+ </path>
162
+ <path>
163
+ <item name="db_background_job" type="b2602c69:ProjectViewProjectNode" />
164
+ <item name="db_background_job" type="462c0819:PsiDirectoryNode" />
165
+ <item name="spec" type="462c0819:PsiDirectoryNode" />
166
+ </path>
167
+ </expand>
168
+ <select />
169
+ </subPane>
170
+ </pane>
171
+ </panes>
172
+ </component>
173
+ <component name="PropertiesComponent">
174
+ <property name="WebServerToolWindowFactoryState" value="false" />
175
+ <property name="last_opened_file_path" value="$PROJECT_DIR$" />
176
+ <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
177
+ <property name="nodejs_npm_path_reset_for_default_project" value="true" />
178
+ <property name="settings.editor.selected.configurable" value="org.jetbrains.plugins.ruby.settings.RubyActiveModuleSdkConfigurable" />
179
+ </component>
180
+ <component name="RecentsManager">
181
+ <key name="MoveFile.RECENT_KEYS">
182
+ <recent name="$PROJECT_DIR$/spec" />
183
+ <recent name="$PROJECT_DIR$/lib" />
184
+ </key>
185
+ </component>
186
+ <component name="RunDashboard">
187
+ <option name="ruleStates">
188
+ <list>
189
+ <RuleState>
190
+ <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
191
+ </RuleState>
192
+ <RuleState>
193
+ <option name="name" value="StatusDashboardGroupingRule" />
194
+ </RuleState>
195
+ </list>
196
+ </option>
197
+ </component>
198
+ <component name="RunManager">
199
+ <configuration name="DbBackgroundJob: db_background_job" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
200
+ <module name="db_background_job" />
201
+ <predefined_log_file enabled="true" id="RUBY_RSPEC" />
202
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
203
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
204
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
205
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
206
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
207
+ <envs>
208
+ <env name="JRUBY_OPTS" value="-X+O" />
209
+ </envs>
210
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
211
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
212
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
213
+ <COVERAGE_PATTERN ENABLED="true">
214
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
215
+ </COVERAGE_PATTERN>
216
+ </EXTENSION>
217
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
218
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/db_background_job_spec.rb" />
219
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
220
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="'**/*_spec.rb'" />
221
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="DbBackgroundJob" />
222
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
223
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
224
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
225
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
226
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
227
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
228
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
229
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
230
+ <method v="2" />
231
+ </configuration>
232
+ <recent_temporary>
233
+ <list>
234
+ <item itemvalue="RSpec.DbBackgroundJob: db_background_job" />
235
+ </list>
236
+ </recent_temporary>
237
+ </component>
238
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
239
+ <component name="SvnConfiguration">
240
+ <configuration />
241
+ </component>
242
+ <component name="TaskManager">
243
+ <task active="true" id="Default" summary="Default task">
244
+ <changelist id="5cf63fcd-2b4f-4272-a6ff-051bfaa035f7" name="Default Changelist" comment="" />
245
+ <created>1735513779873</created>
246
+ <option name="number" value="Default" />
247
+ <option name="presentableId" value="Default" />
248
+ <updated>1735513779873</updated>
249
+ <workItem from="1735513781529" duration="4443000" />
250
+ </task>
251
+ <servers />
252
+ </component>
253
+ <component name="TestHistory">
254
+ <history-entry file="DbBackgroundJob__db_background_job - 2024.12.30 at 01h 45m 47s.xml">
255
+ <configuration name="DbBackgroundJob: db_background_job" configurationId="RSpecRunConfigurationType" />
256
+ </history-entry>
257
+ <history-entry file="DbBackgroundJob__db_background_job - 2024.12.30 at 01h 46m 18s.xml">
258
+ <configuration name="DbBackgroundJob: db_background_job" configurationId="RSpecRunConfigurationType" />
259
+ </history-entry>
260
+ <history-entry file="DbBackgroundJob__db_background_job - 2024.12.30 at 01h 50m 00s.xml">
261
+ <configuration name="DbBackgroundJob: db_background_job" configurationId="RSpecRunConfigurationType" />
262
+ </history-entry>
263
+ <history-entry file="DbBackgroundJob__db_background_job - 2024.12.30 at 01h 51m 07s.xml">
264
+ <configuration name="DbBackgroundJob: db_background_job" configurationId="RSpecRunConfigurationType" />
265
+ </history-entry>
266
+ <history-entry file="DbBackgroundJob__db_background_job - 2024.12.30 at 01h 51m 31s.xml">
267
+ <configuration name="DbBackgroundJob: db_background_job" configurationId="RSpecRunConfigurationType" />
268
+ </history-entry>
269
+ <history-entry file="DbBackgroundJob__db_background_job - 2024.12.30 at 01h 51m 50s.xml">
270
+ <configuration name="DbBackgroundJob: db_background_job" configurationId="RSpecRunConfigurationType" />
271
+ </history-entry>
272
+ <history-entry file="DbBackgroundJob__db_background_job - 2024.12.30 at 01h 52m 14s.xml">
273
+ <configuration name="DbBackgroundJob: db_background_job" configurationId="RSpecRunConfigurationType" />
274
+ </history-entry>
275
+ <history-entry file="DbBackgroundJob__db_background_job - 2024.12.30 at 01h 53m 11s.xml">
276
+ <configuration name="DbBackgroundJob: db_background_job" configurationId="RSpecRunConfigurationType" />
277
+ </history-entry>
278
+ <history-entry file="DbBackgroundJob__db_background_job - 2024.12.30 at 01h 53m 35s.xml">
279
+ <configuration name="DbBackgroundJob: db_background_job" configurationId="RSpecRunConfigurationType" />
280
+ </history-entry>
281
+ <history-entry file="DbBackgroundJob__db_background_job - 2024.12.30 at 01h 53m 50s.xml">
282
+ <configuration name="DbBackgroundJob: db_background_job" configurationId="RSpecRunConfigurationType" />
283
+ </history-entry>
284
+ </component>
285
+ <component name="TimeTrackingManager">
286
+ <option name="totallyTimeSpent" value="4443000" />
287
+ </component>
288
+ <component name="ToolWindowManager">
289
+ <frame x="3840" y="0" width="1920" height="1080" extended-state="6" />
290
+ <editor active="true" />
291
+ <layout>
292
+ <window_info id="Favorites" side_tool="true" />
293
+ <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.17609392" />
294
+ <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
295
+ <window_info anchor="bottom" id="Docker" />
296
+ <window_info anchor="bottom" id="Database Changes" />
297
+ <window_info anchor="bottom" id="Version Control" />
298
+ <window_info anchor="bottom" id="Terminal" />
299
+ <window_info anchor="bottom" id="Event Log" side_tool="true" />
300
+ <window_info anchor="bottom" id="Message" order="0" />
301
+ <window_info anchor="bottom" id="Find" order="1" />
302
+ <window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.3293348" />
303
+ <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
304
+ <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
305
+ <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
306
+ <window_info anchor="bottom" id="TODO" order="6" />
307
+ <window_info anchor="right" id="make" />
308
+ <window_info anchor="right" id="Database" />
309
+ <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
310
+ <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
311
+ <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
312
+ </layout>
313
+ </component>
314
+ <component name="TypeScriptGeneratedFilesManager">
315
+ <option name="version" value="1" />
316
+ </component>
317
+ <component name="editorHistoryManager">
318
+ <entry file="file://$PROJECT_DIR$/bin/console">
319
+ <provider selected="true" editor-type-id="text-editor" />
320
+ </entry>
321
+ <entry file="file://$PROJECT_DIR$/.rspec">
322
+ <provider selected="true" editor-type-id="text-editor" />
323
+ </entry>
324
+ <entry file="file://$PROJECT_DIR$/spec/config/database.yml">
325
+ <provider selected="true" editor-type-id="text-editor">
326
+ <state relative-caret-position="68">
327
+ <caret line="4" column="15" selection-start-line="4" selection-start-column="15" selection-end-line="4" selection-end-column="15" />
328
+ </state>
329
+ </provider>
330
+ </entry>
331
+ <entry file="file://$PROJECT_DIR$/db_background_job.gemspec">
332
+ <provider selected="true" editor-type-id="text-editor">
333
+ <state relative-caret-position="187">
334
+ <caret line="11" column="183" lean-forward="true" selection-start-line="11" selection-start-column="22" selection-end-line="11" selection-end-column="183" />
335
+ </state>
336
+ </provider>
337
+ </entry>
338
+ <entry file="file://$USER_HOME$/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/bundler/ui/shell.rb">
339
+ <provider selected="true" editor-type-id="text-editor">
340
+ <state relative-caret-position="374">
341
+ <caret line="22" column="10" selection-start-line="22" selection-start-column="10" selection-end-line="22" selection-end-column="10" />
342
+ </state>
343
+ </provider>
344
+ </entry>
345
+ <entry file="file://$USER_HOME$/.rvm/gems/ruby-3.0.2/gems/activesupport-7.0.4/lib/active_support/log_subscriber.rb">
346
+ <provider selected="true" editor-type-id="text-editor">
347
+ <state relative-caret-position="280">
348
+ <caret line="126" column="28" selection-start-line="126" selection-start-column="23" selection-end-line="126" selection-end-column="28" />
349
+ </state>
350
+ </provider>
351
+ </entry>
352
+ <entry file="file://$PROJECT_DIR$/README.md">
353
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
354
+ <state split_layout="SPLIT">
355
+ <first_editor relative-caret-position="323">
356
+ <caret line="28" column="29" lean-forward="true" selection-start-line="28" selection-start-column="29" selection-end-line="28" selection-end-column="29" />
357
+ </first_editor>
358
+ <second_editor />
359
+ </state>
360
+ </provider>
361
+ </entry>
362
+ <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
363
+ <provider selected="true" editor-type-id="text-editor">
364
+ <state relative-caret-position="204">
365
+ <caret line="12" column="1" selection-start-line="12" selection-start-column="1" selection-end-line="12" selection-end-column="1" />
366
+ </state>
367
+ </provider>
368
+ </entry>
369
+ <entry file="file://$PROJECT_DIR$/lib/db_background_job.rb">
370
+ <provider selected="true" editor-type-id="text-editor">
371
+ <state relative-caret-position="119">
372
+ <caret line="7" column="11" selection-start-line="7" selection-start-column="11" selection-end-line="7" selection-end-column="11" />
373
+ </state>
374
+ </provider>
375
+ </entry>
376
+ <entry file="file://$PROJECT_DIR$/spec/db_background_job_spec.rb">
377
+ <provider selected="true" editor-type-id="text-editor">
378
+ <state relative-caret-position="374">
379
+ <caret line="22" column="64" lean-forward="true" selection-start-line="22" selection-start-column="64" selection-end-line="22" selection-end-column="64" />
380
+ </state>
381
+ </provider>
382
+ </entry>
383
+ </component>
384
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in db_background_job.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Henry Maestu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # DbBackgroundJob
2
+
3
+ Provides methods to spawn a background process for ActiveRecord. It is recommended to use it with Threads if you have long-taking functions on the database side.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add db_background_job
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install db_background_job
14
+
15
+ ## Usage
16
+
17
+ For example, we have a 500k list of items, lets create 50 extra database connections with Threads and Process to finish job faster on the database side.
18
+
19
+ ```ruby
20
+ threads = []
21
+ # lets create 50 extra database connections
22
+ max_workers = 50
23
+
24
+ items&.each do |item|
25
+ if(Thread.list.count % max_workers != 0)
26
+ thread = Thread.new do
27
+ begin
28
+ DbBackgroundJob.spawn_and_wait do
29
+ # To something here
30
+ end
31
+ rescue => error
32
+ Rails.logger.error error
33
+ end
34
+ end
35
+ threads << thread
36
+ else
37
+ threads.each(&:join)
38
+ thread = Thread.new do
39
+ begin
40
+ DbBackgroundJob.spawn_and_wait do
41
+ # To Something here
42
+ end
43
+ rescue => error
44
+ Rails.logger.error error
45
+ end
46
+ end
47
+ threads << thread
48
+ end
49
+ end
50
+ threads.each(&:join)
51
+ ```
52
+
53
+ In another example, we have a list of items and a Postgres database function that contains heavy calculations and updates ( `SELECT update_and_calculate_sums(ARRAY[item_id])` ).
54
+ To avoid locks in the database we do for example 50(workers/extra sessions) with 250 batches/item_id.
55
+
56
+
57
+ ## Contributing
58
+
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dragonwebeu/db_background_job.
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/db_background_job/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "db_background_job"
7
+ spec.version = DbBackgroundJob::VERSION
8
+ spec.authors = ["Henry Maestu"]
9
+ spec.email = ["dragonwebeu@gmail.com"]
10
+
11
+ spec.summary = "A simple DB side background process library"
12
+ spec.description = "Provides methods to spawn a background process for ActiveRecord. It is recommended to use it with Threads if you have long-taking functions on the database side."
13
+ spec.homepage = "https://github.com/dragonwebeu"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.3.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/dragonwebeu/db_background_job"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(__dir__) do
23
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
+ end
26
+ end
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency "activerecord", ">= 4.0"
30
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DbBackgroundJob
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "db_background_job/version"
4
+
5
+ module DbBackgroundJob
6
+ class Error < StandardError; end
7
+
8
+ def self.spawn(&block)
9
+ with_db_connection do
10
+ pid = Process.fork do
11
+ setup_child(&block)
12
+ end
13
+ Process.detach(pid)
14
+ end
15
+ end
16
+
17
+ def self.spawn_and_wait(&block)
18
+ with_db_connection do
19
+ pid = Process.fork do
20
+ begin
21
+ setup_child(&block)
22
+ exit(0)
23
+ rescue Exception => e
24
+ puts "Error in background job: #{e.inspect}"
25
+ exit(1)
26
+ end
27
+ end
28
+ _, status = Process.wait2(pid)
29
+ status.exitstatus
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def self.with_db_connection(&block)
36
+ dbconfig = ActiveRecord::Base.remove_connection
37
+ begin
38
+ yield
39
+ ensure
40
+ ActiveRecord::Base.establish_connection(dbconfig)
41
+ end
42
+ end
43
+
44
+ def self.setup_child(&block)
45
+ ActiveRecord::Base.establish_connection
46
+ block.call
47
+ ensure
48
+ ActiveRecord::Base.remove_connection
49
+ end
50
+ end
@@ -0,0 +1,4 @@
1
+ module DbBackgroundJob
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: db_background_job
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Henry Maestu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-12-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ description: Provides methods to spawn a background process for ActiveRecord. It is
28
+ recommended to use it with Threads if you have long-taking functions on the database
29
+ side.
30
+ email:
31
+ - dragonwebeu@gmail.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - ".idea/.rakeTasks"
37
+ - ".idea/db_background_job.iml"
38
+ - ".idea/encodings.xml"
39
+ - ".idea/inspectionProfiles/Project_Default.xml"
40
+ - ".idea/misc.xml"
41
+ - ".idea/modules.xml"
42
+ - ".idea/vcs.xml"
43
+ - ".idea/workspace.xml"
44
+ - ".rspec"
45
+ - Gemfile
46
+ - LICENSE.txt
47
+ - README.md
48
+ - Rakefile
49
+ - db_background_job.gemspec
50
+ - lib/db_background_job.rb
51
+ - lib/db_background_job/version.rb
52
+ - sig/db_background_job.rbs
53
+ homepage: https://github.com/dragonwebeu
54
+ licenses:
55
+ - MIT
56
+ metadata:
57
+ homepage_uri: https://github.com/dragonwebeu
58
+ source_code_uri: https://github.com/dragonwebeu/db_background_job
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 2.3.0
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubygems_version: 3.2.3
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: A simple DB side background process library
78
+ test_files: []