windmill-components 1.379.3 → 1.379.4

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.
@@ -11,7 +11,7 @@ import { createEventDispatcher } from 'svelte';
11
11
  import { ArrowBigUp } from 'lucide-svelte';
12
12
  import { enterpriseLicense, workspaceStore } from '../../stores';
13
13
  import { WorkspaceService } from '../../gen';
14
- import { ALL_DEPLOYABLE } from '../../utils';
14
+ import { ALL_DEPLOYABLE } from '../../utils_deployable';
15
15
  export let item;
16
16
  export let depth = 0;
17
17
  const dispatch = createEventDispatcher();
@@ -1,6 +1,7 @@
1
1
  import { get } from 'svelte/store';
2
2
  import { dbClockDrift } from './stores';
3
3
  import { JobService } from './gen';
4
+ import pLimit from 'p-limit';
4
5
  function subtractSeconds(date, seconds) {
5
6
  date.setSeconds(date.getSeconds() - seconds);
6
7
  return date;
@@ -9,17 +10,20 @@ function adjustDate(drift) {
9
10
  return new Date(Date.now() + drift);
10
11
  }
11
12
  export async function computeDrift() {
12
- const now = Date.now();
13
- const dbClock = await JobService.getDbClock();
14
- dbClockDrift.set(dbClock - now);
13
+ if (get(dbClockDrift) == undefined) {
14
+ const now = Date.now();
15
+ const dbClock = await JobService.getDbClock();
16
+ dbClockDrift.set(dbClock - now);
17
+ }
15
18
  }
16
19
  export function forLater(scheduledString) {
17
20
  return getDbClockNow() < subtractSeconds(new Date(scheduledString), 5);
18
21
  }
22
+ const limit = pLimit(1);
19
23
  export function getDbClockNow() {
20
24
  let drift = get(dbClockDrift);
21
25
  if (drift == undefined) {
22
- computeDrift();
26
+ limit(() => computeDrift());
23
27
  drift = 0;
24
28
  }
25
29
  return adjustDate(drift);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-components",
3
- "version": "1.379.3",
3
+ "version": "1.379.4",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build",