diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 78b9b3f38d80d48bd548b9a5beb177198d319a7d..ce1c9f4262e8d317ac3be0db553635bda3619130 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,9 +27,6 @@ tests: - nixos-gen3 script: - nix develop .#gitlab --command run-ci-tests - artifacts: - paths: - - last-phpunit-result.xml release: stage: release diff --git a/.idea/job-queues.iml b/.idea/job-queues.iml index 25ed3f6e7b6e344b6ca91ebcc5d005f35357f9cf..64f7741f8b6f7d6831cdd15bf0b42c36802ecb18 100644 --- a/.idea/job-queues.iml +++ b/.idea/job-queues.iml @@ -3,7 +3,9 @@ <component name="Go" enabled="true" /> <component name="NewModuleRootManager" inherit-compiler-output="true"> <exclude-output /> - <content url="file://$MODULE_DIR$" /> + <content url="file://$MODULE_DIR$"> + <excludeFolder url="file://$MODULE_DIR$/.direnv" /> + </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> </component> diff --git a/.idea/workspace.xml b/.idea/workspace.xml index f0ed4807c03cd63f6e71f5411e06466bbe02f6c1..320aed89f6f61d499f6ebad4aae77d72ee56b956 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,7 +4,9 @@ <option name="autoReloadType" value="SELECTIVE" /> </component> <component name="ChangeListManager"> - <list default="true" id="9979eb22-471e-4f2f-b624-fd3edb5e8c6e" name="Changes" comment="" /> + <list default="true" id="9979eb22-471e-4f2f-b624-fd3edb5e8c6e" name="Changes" comment=""> + <change beforePath="$PROJECT_DIR$/.gitlab-ci.yml" beforeDir="false" afterPath="$PROJECT_DIR$/.gitlab-ci.yml" afterDir="false" /> + </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> @@ -20,11 +22,11 @@ </list> </option> </component> - <component name="GOROOT" url="file:///nix/store/fqzds43dcw7164rm1h51n54l2ipxi1qj-go-1.21.9/share/go" /> + <component name="GOROOT" url="file:///nix/store/j9hk9x78z301jqldfyvw72z24vb992qi-go-1.22.6/share/go" /> <component name="Git.Settings"> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> </component> - <component name="PhpWorkspaceProjectConfiguration" interpreter_name="PHP 8.3 with extension" /> + <component name="PhpWorkspaceProjectConfiguration" interpreter_name="/nix/store/g9h6sivhpp3fqah43affp5q1kjz7351p-php-with-extensions-8.3.11/bin/php" /> <component name="ProjectColorInfo">{ "customColor": "", "associatedIndex": 8 @@ -42,6 +44,7 @@ "keyToString": { "DefaultGoTemplateProperty": "Go File", "Go Test.TestCreateJobAndSchedulerFromInput in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", + "Go Test.TestDeleteJob in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", "Go Test.TestDummyRunnable in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", "Go Test.TestJobPersistenceUnmarshalJSON in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", "Go Test.TestJobPersistenceUnmarshalJSON/Date_and_Time in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", @@ -62,10 +65,18 @@ "Go Test.TestUnmarshalSchedulerPersistenceIntervalYAML in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", "Go Test.TestUnmarshalSchedulerPersistenceYAML in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", "Go Test.TestUnmarshalYAML in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", + "Go Test.TestWorkerLifeCycle in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", "Go Test.TestWriteToDB1 in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", "Go Test.TestWriteToDB2 in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", "Go Test.TestWriteToDB4 in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", "Go Test.go test gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", + "NIXITCH_NIXPKGS_CONFIG": "/etc/nix/nixpkgs-config.nix", + "NIXITCH_NIX_CONF_DIR": "", + "NIXITCH_NIX_OTHER_STORES": "", + "NIXITCH_NIX_PATH": "/home/vs/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels", + "NIXITCH_NIX_PROFILES": "/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/vs /home/vs/.local/state/nix/profile /nix/profile /home/vs/.nix-profile", + "NIXITCH_NIX_REMOTE": "", + "NIXITCH_NIX_USER_PROFILE_DIR": "/nix/var/nix/profiles/per-user/vs", "RunOnceActivity.ShowReadmeOnStart": "true", "RunOnceActivity.go.formatter.settings.were.checked": "true", "RunOnceActivity.go.migrated.go.modules.settings": "true", @@ -80,7 +91,7 @@ "node.js.selected.package.eslint": "(autodetect)", "node.js.selected.package.tslint": "(autodetect)", "nodejs_package_manager_path": "npm", - "settings.editor.selected.configurable": "http.proxy", + "settings.editor.selected.configurable": "go.sdk", "vue.rearranger.settings.migration": "true" } }]]></component> @@ -94,7 +105,7 @@ <recent name="$PROJECT_DIR$/.back" /> </key> </component> - <component name="RunManager" selected="Go Test.TestWriteToDB4 in gitlab.schukai.com/oss/libraries/go/services/job-queues"> + <component name="RunManager" selected="Go Test.go test gitlab.schukai.com/oss/libraries/go/services/job-queues"> <configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application"> <module name="job-queues" /> <working_directory value="$PROJECT_DIR$" /> @@ -104,81 +115,140 @@ <filePath value="$PROJECT_DIR$" /> <method v="2" /> </configuration> - <configuration name="TestJobPersistence_MarshalUnmarshalJSON in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> + <configuration name="TestDeleteJob in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> <module name="job-queues" /> <working_directory value="$PROJECT_DIR$" /> + <envs> + <env name="CGO_CFLAGS" value="-O2 -U_FORTIFY_SOURCE" /> + <env name="CGO_ENABLED" value="0 " /> + <env name="CGO_LDFLAGS" value="-U_FORTIFY_SOURCE" /> + </envs> + <EXTENSION ID="com.fapiko.jetbrains.plugins.better_direnv.runconfigs.GolandRunConfigurationExtension"> + <option name="DIRENV_ENABLED" value="true" /> + <option name="DIRENV_TRUSTED" value="true" /> + </EXTENSION> + <EXTENSION ID="net.ashald.envfile"> + <option name="IS_ENABLED" value="true" /> + <option name="IS_SUBST" value="false" /> + <option name="IS_PATH_MACRO_SUPPORTED" value="false" /> + <option name="IS_IGNORE_MISSING_FILES" value="false" /> + <option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> + <ENTRIES> + <ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> + </ENTRIES> + </EXTENSION> <kind value="PACKAGE" /> <package value="gitlab.schukai.com/oss/libraries/go/services/job-queues" /> <directory value="$PROJECT_DIR$" /> <filePath value="$PROJECT_DIR$" /> <framework value="gotest" /> - <pattern value="^\QTestJobPersistence_MarshalUnmarshalJSON\E$" /> + <pattern value="^\QTestDeleteJob\E$" /> <method v="2" /> </configuration> - <configuration name="TestUnmarshalJSON in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> + <configuration name="TestWorkerLifeCycle in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> <module name="job-queues" /> <working_directory value="$PROJECT_DIR$" /> + <envs> + <env name="CGO_CFLAGS" value="-O2 -U_FORTIFY_SOURCE" /> + <env name="CGO_ENABLED" value="0 " /> + <env name="CGO_LDFLAGS" value="-U_FORTIFY_SOURCE" /> + </envs> + <EXTENSION ID="com.fapiko.jetbrains.plugins.better_direnv.runconfigs.GolandRunConfigurationExtension"> + <option name="DIRENV_ENABLED" value="true" /> + <option name="DIRENV_TRUSTED" value="true" /> + </EXTENSION> + <EXTENSION ID="net.ashald.envfile"> + <option name="IS_ENABLED" value="true" /> + <option name="IS_SUBST" value="false" /> + <option name="IS_PATH_MACRO_SUPPORTED" value="false" /> + <option name="IS_IGNORE_MISSING_FILES" value="false" /> + <option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> + <ENTRIES> + <ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> + </ENTRIES> + </EXTENSION> <kind value="PACKAGE" /> <package value="gitlab.schukai.com/oss/libraries/go/services/job-queues" /> <directory value="$PROJECT_DIR$" /> <filePath value="$PROJECT_DIR$" /> <framework value="gotest" /> - <pattern value="^\QTestUnmarshalJSON\E$" /> + <pattern value="^\QTestWorkerLifeCycle\E$" /> <method v="2" /> </configuration> - <configuration name="TestUnmarshalSchedulerPersistenceIntervalYAML in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> - <module name="job-queues" /> - <working_directory value="$PROJECT_DIR$" /> - <kind value="PACKAGE" /> - <package value="gitlab.schukai.com/oss/libraries/go/services/job-queues" /> - <directory value="$PROJECT_DIR$" /> - <filePath value="$PROJECT_DIR$" /> - <framework value="gotest" /> - <pattern value="^\QTestUnmarshalSchedulerPersistenceIntervalYAML\E$" /> - <method v="2" /> - </configuration> - <configuration name="TestUnmarshalSchedulerPersistenceYAML in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> + <configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test"> <module name="job-queues" /> <working_directory value="$PROJECT_DIR$" /> - <kind value="PACKAGE" /> + <go_parameters value="-i" /> + <envs> + <env name="CGO_CFLAGS" value="-O2 -U_FORTIFY_SOURCE" /> + <env name="CGO_ENABLED" value="0 " /> + <env name="CGO_LDFLAGS" value="-U_FORTIFY_SOURCE" /> + </envs> + <EXTENSION ID="com.fapiko.jetbrains.plugins.better_direnv.runconfigs.GolandRunConfigurationExtension"> + <option name="DIRENV_ENABLED" value="true" /> + <option name="DIRENV_TRUSTED" value="true" /> + </EXTENSION> + <EXTENSION ID="net.ashald.envfile"> + <option name="IS_ENABLED" value="true" /> + <option name="IS_SUBST" value="false" /> + <option name="IS_PATH_MACRO_SUPPORTED" value="false" /> + <option name="IS_IGNORE_MISSING_FILES" value="false" /> + <option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> + <ENTRIES> + <ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> + </ENTRIES> + </EXTENSION> + <kind value="DIRECTORY" /> <package value="gitlab.schukai.com/oss/libraries/go/services/job-queues" /> <directory value="$PROJECT_DIR$" /> <filePath value="$PROJECT_DIR$" /> <framework value="gotest" /> - <pattern value="^\QTestUnmarshalSchedulerPersistenceYAML\E$" /> <method v="2" /> </configuration> - <configuration name="TestWriteToDB4 in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> + <configuration name="go test gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> <module name="job-queues" /> <working_directory value="$PROJECT_DIR$" /> + <envs> + <env name="CGO_CFLAGS" value="-O2 -U_FORTIFY_SOURCE" /> + <env name="CGO_ENABLED" value="0 " /> + <env name="CGO_LDFLAGS" value="-U_FORTIFY_SOURCE" /> + </envs> + <EXTENSION ID="com.fapiko.jetbrains.plugins.better_direnv.runconfigs.GolandRunConfigurationExtension"> + <option name="DIRENV_ENABLED" value="true" /> + <option name="DIRENV_TRUSTED" value="true" /> + </EXTENSION> + <EXTENSION ID="net.ashald.envfile"> + <option name="IS_ENABLED" value="true" /> + <option name="IS_SUBST" value="false" /> + <option name="IS_PATH_MACRO_SUPPORTED" value="false" /> + <option name="IS_IGNORE_MISSING_FILES" value="false" /> + <option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> + <ENTRIES> + <ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> + </ENTRIES> + </EXTENSION> <kind value="PACKAGE" /> <package value="gitlab.schukai.com/oss/libraries/go/services/job-queues" /> <directory value="$PROJECT_DIR$" /> <filePath value="$PROJECT_DIR$" /> <framework value="gotest" /> - <pattern value="^\QTestWriteToDB4\E$" /> - <method v="2" /> - </configuration> - <configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test"> - <module name="job-queues" /> - <working_directory value="$PROJECT_DIR$" /> - <go_parameters value="-i" /> - <kind value="DIRECTORY" /> - <directory value="$PROJECT_DIR$" /> - <filePath value="$PROJECT_DIR$" /> - <framework value="gotest" /> <method v="2" /> </configuration> <recent_temporary> <list> - <item itemvalue="Go Test.TestWriteToDB4 in gitlab.schukai.com/oss/libraries/go/services/job-queues" /> - <item itemvalue="Go Test.TestJobPersistence_MarshalUnmarshalJSON in gitlab.schukai.com/oss/libraries/go/services/job-queues" /> - <item itemvalue="Go Test.TestUnmarshalJSON in gitlab.schukai.com/oss/libraries/go/services/job-queues" /> - <item itemvalue="Go Test.TestUnmarshalSchedulerPersistenceYAML in gitlab.schukai.com/oss/libraries/go/services/job-queues" /> - <item itemvalue="Go Test.TestUnmarshalSchedulerPersistenceIntervalYAML in gitlab.schukai.com/oss/libraries/go/services/job-queues" /> + <item itemvalue="Go Test.go test gitlab.schukai.com/oss/libraries/go/services/job-queues" /> + <item itemvalue="Go Test.TestWorkerLifeCycle in gitlab.schukai.com/oss/libraries/go/services/job-queues" /> + <item itemvalue="Go Test.TestDeleteJob in gitlab.schukai.com/oss/libraries/go/services/job-queues" /> </list> </recent_temporary> </component> + <component name="SharedIndexes"> + <attachedChunks> + <set> + <option value="bundled-js-predefined-d6986cc7102b-7c0b70fcd90d-JavaScript-IU-242.21829.142" /> + </set> + </attachedChunks> + </component> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> <component name="TypeScriptGeneratedFilesManager"> <option name="version" value="3" /> @@ -231,27 +301,16 @@ <line>25</line> <option name="timeStamp" value="18" /> </line-breakpoint> - <line-breakpoint enabled="true" type="DlvLineBreakpoint"> - <url>file://$PROJECT_DIR$/database-2_test.go</url> - <line>32</line> - <option name="timeStamp" value="20" /> - </line-breakpoint> - <line-breakpoint enabled="true" type="DlvLineBreakpoint"> - <url>file://$PROJECT_DIR$/scheduler.go</url> - <line>154</line> - <option name="timeStamp" value="35" /> - </line-breakpoint> <line-breakpoint enabled="true" type="DlvLineBreakpoint"> <url>file://$PROJECT_DIR$/manager.go</url> <line>154</line> <option name="timeStamp" value="37" /> </line-breakpoint> - <line-breakpoint enabled="true" type="DlvLineBreakpoint"> - <url>file://$PROJECT_DIR$/database-4_test.go</url> - <line>78</line> - <option name="timeStamp" value="42" /> - </line-breakpoint> </breakpoints> </breakpoint-manager> </component> + <component name="XSLT-Support.FileAssociations.UIState"> + <expand /> + <select /> + </component> </project> \ No newline at end of file diff --git a/manager.go b/manager.go index 8b69760041e6b70f51f7961c2d50a8fab68b17d4..ef5354bab1ddfdb5a059891a761e0c2088ffba77 100644 --- a/manager.go +++ b/manager.go @@ -748,8 +748,10 @@ func (m *Manager) handleJobEvents() { if nextJob.GetScheduler() != nil { if nextJob.GetScheduler().IsAdHoc() { - //eventBus := m.GetEventBus() - //eventBus.Publish(JobFinished, nextJob) + if m != nil { + eventBus := m.GetEventBus() + eventBus.Publish(JobFinished, nextJob) + } } } } diff --git a/nix/config/release.nix b/nix/config/release.nix index 1beb5861d5e4c3d96edadd22f1d71e55029188f0..15cb466ce5934192b4ecfed052793409283fec0f 100644 --- a/nix/config/release.nix +++ b/nix/config/release.nix @@ -2,8 +2,8 @@ # this file is generated by nix/scripts/init-project.nix # please don't edit it manually - version = "1.19.4"; - commit = "deb4cad6cd14bb73447a9e6afd1bd19049baacd1"; + version = "1.20.1"; + commit = "2bb74106a03738c80e384ee267ef57bc40ab8c92"; projectURL = "https://gitlab.schukai.com/oss/libraries/go/services/job-queues"; name = "job-queues"; mnemonic = "job-queues"; diff --git a/worker.go b/worker.go index 856910af24969a315d060148341d88048cecb28e..922904f878e4999bc74bd1b8a9f3803920d7b42c 100644 --- a/worker.go +++ b/worker.go @@ -244,10 +244,12 @@ func (w *LocalWorker) run(jobChannel chan GenericJob, stopChan chan bool, cancel defer w.mu.Unlock() if w.manager != nil { _ = w.manager.Sync(job) - } - //eventBus := w.manager.GetEventBus() - //eventBus.Publish(JobDone, job.GetID()) + eventBus := w.manager.GetEventBus() + if eventBus != nil { + eventBus.Publish(JobDone, job) + } + } }()