Skip to content

Commit

Permalink
Add safegoard for out of control loop on internal error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Jan 6, 2024
1 parent e723717 commit c649a69
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 85 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ const { Cron } = require("croner");
Using Deno

```typescript
import { Cron } from "https://deno.land/x/croner@8.0.0/dist/croner.js";
import { Cron } from "https://deno.land/x/croner@8.0.1/dist/croner.js";
```

In a webpage using the UMD-module

```html
<script src="https://cdn.jsdelivr.net/npm/croner@7/dist/croner.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/croner@8/dist/croner.umd.min.js"></script>
```

## Documentation
Expand Down
3 changes: 2 additions & 1 deletion dist/croner.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dist/croner.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/croner.min.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/croner.min.cjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/croner.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/croner.min.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/croner.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/croner.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/croner.umd.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/src/_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": "Cron for JavaScript and TypeScript"
},
"substitute": {
"$CRONER_VERSION": "8.0.0"
"$CRONER_VERSION": "8.0.1"
},
"top_links": [
{
Expand Down
151 changes: 80 additions & 71 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "croner",
"version": "8.0.0",
"version": "8.0.1-dev.0",
"description": "Trigger functions and/or evaluate cron expressions in JavaScript. No dependencies. Most features. All environments.",
"author": "Hexagon <github.com/hexagon>",
"homepage": "https://hexagon.github.io/croner",
Expand Down
3 changes: 2 additions & 1 deletion src/croner.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ Cron.prototype.schedule = function (func) {
// Get the target date based on previous run
const target = this.nextRun(this._states.currentRun);

if (waitMs === null || target === null) return this;
// isNaN added to prevent infinite loop
if (waitMs === null || waitMs === undefined || isNaN(waitMs) || target === null) return this;

// setTimeout cant handle more than Math.pow(2, 32 - 1) - 1 ms
if (waitMs > maxDelay) {
Expand Down

0 comments on commit c649a69

Please sign in to comment.