Prepend broker files with Memory
Co-authored-by: Fredrik Adelöw <freben@gmail.com> Co-authored-by: blam<ben@blam.sh> Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ export interface Database {
|
||||
setStatus(taskId: string, status: Status): Promise<void>;
|
||||
}
|
||||
|
||||
export class InMemoryDatabase implements Database {
|
||||
export class MemoryDatabase implements Database {
|
||||
private readonly store = new Map<string, DbTaskRow>();
|
||||
|
||||
async heartBeat(runId: string): Promise<void> {
|
||||
+3
-3
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { InMemoryDatabase } from './Database';
|
||||
import { MemoryTaskBroker, TaskAgent } from './TaskBroker';
|
||||
import { MemoryDatabase } from './MemoryDatabase';
|
||||
import { MemoryTaskBroker, TaskAgent } from './MemoryTaskBroker';
|
||||
|
||||
describe('MemoryTaskBroker', () => {
|
||||
const storage = new InMemoryDatabase();
|
||||
const storage = new MemoryDatabase();
|
||||
const broker = new MemoryTaskBroker(storage);
|
||||
|
||||
it('should claim a dispatched work item', async () => {
|
||||
+3
-3
@@ -21,12 +21,12 @@ import {
|
||||
TaskBroker,
|
||||
DispatchResult,
|
||||
} from './types';
|
||||
import { InMemoryDatabase } from './Database';
|
||||
import { MemoryDatabase } from './MemoryDatabase';
|
||||
|
||||
export class TaskAgent implements Task {
|
||||
private heartbeartInterval?: ReturnType<typeof setInterval>;
|
||||
|
||||
static create(state: TaskState, storage: InMemoryDatabase) {
|
||||
static create(state: TaskState, storage: MemoryDatabase) {
|
||||
const agent = new TaskAgent(state, storage);
|
||||
agent.start();
|
||||
return agent;
|
||||
@@ -35,7 +35,7 @@ export class TaskAgent implements Task {
|
||||
// Runs heartbeat internally
|
||||
private constructor(
|
||||
private readonly state: TaskState,
|
||||
private readonly storage: InMemoryDatabase,
|
||||
private readonly storage: MemoryDatabase,
|
||||
) {}
|
||||
|
||||
get spec() {
|
||||
Reference in New Issue
Block a user