Skip to content

Commit

Permalink
Fixing process start delays
Browse files Browse the repository at this point in the history
  • Loading branch information
morfien101 committed Jun 8, 2021
1 parent 8ae2c6a commit 3b11d55
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 4 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: build and test
on: [push]
jobs:
just_test:
if: startsWith(github.ref, 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.13.1'
- name: go test
run: go test -v ./...
test_build_release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.13.1'
- name: Get the version
id: get_tag
run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: go test
run: go test -v ./...
- name: build
shell: bash
run: |
# Make an artifacts directory
mkdir -p artifacts
# run the build for each supported OS
for os in "linux" "darwin" "windows"; do
echo "Building for $os..."
GOOS=$os CGO_ENABLED=0 go build -a -ldflags="-X main.version=${{ steps.get_tag.outputs.SOURCE_TAG }}" -o ./artifacts/launch_${os} .
# If its windows we need to rename it to have .exe at the end.
if [ $os == "windows" ]; then
mv ./artifacts/launch_$os ./artifacts/launch_$os.exe
fi
done
# Make an Arm bin for linux also
for arch in arm64 arm; do
echo "Building for linux on $arch..."
GOOS=linux GOARCH=$arch CGO_ENABLED=0 go build -a -ldflags="-X main.version=${{ steps.get_tag.outputs.SOURCE_TAG }}" -o ./artifacts/launch_linux_${arch} .
done
- name: Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/*
body_path: .github/workflows/release_body.md
env:
GITHUB_TOKEN: ${{ github.token }}
4 changes: 4 additions & 0 deletions .github/workflows/release_body.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Bug fix and Github work flows

Fixed a bug where processes set to have a start delay did not delay.
Adding in Github work flow.
3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"pmlogger"
]
}
4 changes: 3 additions & 1 deletion processmanager/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (p *Process) running() bool {

func (p *Process) processStartDelay() {
if p.config.StartDelay != 0 {
p.pmlogger.Debugf("Process start is configured for delayed start of %d seconds.\n", p.config.StartDelay)
p.pmlogger.Printf("Process start is configured for delayed start of %d seconds.\n", p.config.StartDelay)
time.Sleep(time.Second * time.Duration(p.config.StartDelay))
}
}
Expand All @@ -55,6 +55,8 @@ func (p *Process) runProcess(processType string) *processEnd {
ExitCode: -1,
}

p.processStartDelay()

if err := p.proc.Start(); err != nil {
p.exitcode = 1
finalState.Error = err
Expand Down

0 comments on commit 3b11d55

Please sign in to comment.