-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Squashed commit of the following: commit 4c3be07 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Aug 3 11:57:25 2020 +0530 Bump elliptic from 6.5.2 to 6.5.3 in /client (#6) Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3. - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](indutny/elliptic@v6.5.2...v6.5.3) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 3e75da1 Author: sn123 <[email protected]> Date: Thu Jul 30 14:56:42 2020 +0530 Update issue templates commit 433830e Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Jul 20 10:29:57 2020 +0530 Bump lodash from 4.17.15 to 4.17.19 in /client (#5) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.15...4.17.19) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 202271c Merge: 8428d98 72c3cbe Author: sn123 <[email protected]> Date: Fri Jun 12 11:45:49 2020 +0530 Merge pull request #4 from goavega-software/develop Change log.Fatal to Println commit 8428d98 Merge: 4cfaeb0 1297b79 Author: sn123 <[email protected]> Date: Thu Jun 11 15:21:22 2020 +0530 Merge pull request #3 from goavega-software/dependabot/npm_and_yarn/client/websocket-extensions-0.1.4 Bump websocket-extensions from 0.1.3 to 0.1.4 in /client commit 1297b79 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Jun 8 02:20:08 2020 +0000 Bump websocket-extensions from 0.1.3 to 0.1.4 in /client Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-node) from 0.1.3 to 0.1.4. - [Release notes](https://github.com/faye/websocket-extensions-node/releases) - [Changelog](https://github.com/faye/websocket-extensions-node/blob/master/CHANGELOG.md) - [Commits](faye/websocket-extensions-node@0.1.3...0.1.4) Signed-off-by: dependabot[bot] <[email protected]> commit 4cfaeb0 Merge: 92a58b2 8cb8fa1 Author: sn123 <[email protected]> Date: Fri May 29 00:09:41 2020 +0530 Merge pull request #2 from goavega-software/develop Add docker-compose support. Fixes #1 * Configurable jobs (#7)
- Loading branch information
Showing
10 changed files
with
66 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package core | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
) | ||
|
||
type JobFactory struct { | ||
} | ||
|
||
type Schedule struct { | ||
Name string `json:"name"` | ||
Schedule string `json:"schedule"` | ||
} | ||
|
||
var factory *JobFactory | ||
var advertisedJobs map[string]func() = make(map[string]func()) | ||
|
||
/* | ||
Process parses the json and only schedules enabled jobs | ||
*/ | ||
func (jf JobFactory) Process(schedule string) { | ||
schedules := make([]Schedule, 0) | ||
json.Unmarshal([]byte(schedule), &schedules) | ||
for _, item := range schedules { | ||
value, ok := advertisedJobs[item.Name] | ||
if ok { | ||
log.Printf("%s, %s", item.Schedule, item.Name) | ||
AddJob(item.Schedule, value) | ||
} | ||
} | ||
} | ||
|
||
/* | ||
Advertise All jobs should "advertise" themselves with a name and execute function | ||
***/ | ||
func (jf JobFactory) Advertise(name string, executor func()) { | ||
advertisedJobs[name] = executor | ||
} | ||
|
||
/* | ||
GetFactory a non-thread safe way of getting the factory. It's not called make since it mimics a singleton | ||
*/ | ||
func GetFactory() *JobFactory { | ||
if factory == nil { | ||
factory = &JobFactory{} | ||
} | ||
return factory | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters