-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove current implementation of
MergeConflict
- Loading branch information
Showing
9 changed files
with
40 additions
and
37 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 |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import { detectMergeConflict } from "../merge-conflict/detectMergeConflict.js" | ||
import { isRunning } from "../scheduler/run.js" | ||
|
||
import { clearScheduledPropagators } from "../scheduler/schedule.js" | ||
import { log } from "../utils/log.js" | ||
|
||
export function checkConsistent(value: any): void { | ||
return | ||
|
||
if (detectMergeConflict(value)) { | ||
const who = "checkConsistent" | ||
const message = "Inconsistent value" | ||
log({ who, message, value }) | ||
clearScheduledPropagators() | ||
|
||
if (isRunning) { | ||
throw new Error(`[${who}] ${message}`) | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from "./belief-monad.js" | ||
export * from "./belief-system-monad.js" | ||
export * from "./merge-conflict-monad.js" | ||
export * from "./monad.js" | ||
export * from "./nothing-monad.js" |
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,9 @@ | ||
import { defineHandler } from "../generic/index.js" | ||
import { isMergeConflict } from "../merge-conflict/index.js" | ||
import { nothing } from "../nothing/index.js" | ||
import { isFunction } from "../utils/isFunction.js" | ||
import { flatten, fmap } from "./monad.js" | ||
|
||
defineHandler(fmap, [isFunction, isMergeConflict], (f, ma) => nothing) | ||
|
||
defineHandler(flatten, [isMergeConflict], (mma) => nothing) |
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 |
---|---|---|
@@ -1,17 +1,10 @@ | ||
import type { Job } from "./Scheduler.js" | ||
import { globalScheduler } from "./initializeScheduler.js" | ||
|
||
export let isRunning = false | ||
export async function run(): Promise<void> { | ||
try { | ||
isRunning = true | ||
while (globalScheduler.jobs.length > 0) { | ||
// 我们用「先进先出」的方式来处理 job 的 queue。 | ||
const job = globalScheduler.jobs.shift() as Job | ||
await job.propagator() | ||
} | ||
isRunning = false | ||
} catch (error) { | ||
console.error({ who: "run", error }) | ||
while (globalScheduler.jobs.length > 0) { | ||
// 我们用「先进先出」的方式来处理 job 的 queue。 | ||
const job = globalScheduler.jobs.shift() as Job | ||
await job.propagator() | ||
} | ||
} |