mirror of
https://github.com/IT4Change/gradido.git
synced 2026-03-28 05:05:38 +00:00
remove not longer used stuff, fix lint workflow
This commit is contained in:
parent
617b1d6ad5
commit
0525b144b7
1
.github/workflows/lint.yml
vendored
1
.github/workflows/lint.yml
vendored
@ -12,6 +12,7 @@ jobs:
|
||||
backend: ${{ steps.backend.outputs.success }}
|
||||
database: ${{ steps.database.outputs.success }}
|
||||
dht-node: ${{ steps.dht-node.outputs.success }}
|
||||
dlt-connector: ${{ steps.dlt-connector.outputs.success }}
|
||||
federation: ${{ steps.federation.outputs.success }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
@ -185,8 +185,6 @@ export const executeTransaction = async (
|
||||
await queryRunner.release()
|
||||
}
|
||||
|
||||
// notify dlt-connector loop for new work
|
||||
// InterruptiveSleepManager.getInstance().interrupt(TRANSMIT_TO_IOTA_INTERRUPTIVE_SLEEP_KEY)
|
||||
await sendTransactionReceivedEmail({
|
||||
firstName: recipient.firstName,
|
||||
lastName: recipient.lastName,
|
||||
|
||||
@ -20,10 +20,6 @@ async function main() {
|
||||
console.log(`GraphIQL available at http://localhost:${CONFIG.PORT}`)
|
||||
}
|
||||
})
|
||||
// task is running the whole time for transmitting transaction via dlt-connector to iota
|
||||
// can be notified with InterruptiveSleepManager.getInstance().interrupt(TRANSMIT_TO_IOTA_INTERRUPTIVE_SLEEP_KEY)
|
||||
// that a new transaction or user was stored in db
|
||||
// void sendTransactionsToDltConnector()
|
||||
void startValidateCommunities(Number(CONFIG.FEDERATION_VALIDATE_COMMUNITY_TIMER))
|
||||
}
|
||||
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
import { delay } from 'core'
|
||||
|
||||
/**
|
||||
* Sleep, that can be interrupted
|
||||
* call sleep only for msSteps and than check if interrupt was called
|
||||
*/
|
||||
export class InterruptiveSleep {
|
||||
private interruptSleep = false
|
||||
private msSteps = 10
|
||||
|
||||
constructor(msSteps: number) {
|
||||
this.msSteps = msSteps
|
||||
}
|
||||
|
||||
public interrupt(): void {
|
||||
this.interruptSleep = true
|
||||
}
|
||||
|
||||
public async sleep(ms: number): Promise<void> {
|
||||
let waited = 0
|
||||
this.interruptSleep = false
|
||||
while (waited < ms && !this.interruptSleep) {
|
||||
await delay(this.msSteps)
|
||||
waited += this.msSteps
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
import { InterruptiveSleep } from './InterruptiveSleep'
|
||||
|
||||
// Source: https://refactoring.guru/design-patterns/singleton/typescript/example
|
||||
// and ../federation/client/FederationClientFactory.ts
|
||||
/**
|
||||
* Managing Instances of interruptive sleep it is inspired from conditions from c++ multithreading
|
||||
* It is used for separate worker threads which will go to sleep after they haven't anything todo left,
|
||||
* but with this Manager and InterruptiveSleep Object it sleeps only stepSize and check if something interrupted his sleep,
|
||||
* so he can check for new work
|
||||
*/
|
||||
export const TRANSMIT_TO_IOTA_INTERRUPTIVE_SLEEP_KEY = 'transmitToIota'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
||||
export class InterruptiveSleepManager {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
private static instance: InterruptiveSleepManager
|
||||
private interruptiveSleep: Map<string, InterruptiveSleep> = new Map<string, InterruptiveSleep>()
|
||||
private stepSizeMilliseconds = 10
|
||||
|
||||
/**
|
||||
* The Singleton's constructor should always be private to prevent direct
|
||||
* construction calls with the `new` operator.
|
||||
*/
|
||||
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
||||
private constructor() {}
|
||||
|
||||
/**
|
||||
* The static method that controls the access to the singleton instance.
|
||||
*
|
||||
* This implementation let you subclass the Singleton class while keeping
|
||||
* just one instance of each subclass around.
|
||||
*/
|
||||
public static getInstance(): InterruptiveSleepManager {
|
||||
if (!InterruptiveSleepManager.instance) {
|
||||
InterruptiveSleepManager.instance = new InterruptiveSleepManager()
|
||||
}
|
||||
return InterruptiveSleepManager.instance
|
||||
}
|
||||
|
||||
/**
|
||||
* only for new created InterruptiveSleepManager Entries!
|
||||
* @param step size in ms in which new! InterruptiveSleepManager check if they where triggered
|
||||
*/
|
||||
public setStepSize(ms: number) {
|
||||
this.stepSizeMilliseconds = ms
|
||||
}
|
||||
|
||||
public interrupt(key: string): void {
|
||||
const interruptiveSleep = this.interruptiveSleep.get(key)
|
||||
if (interruptiveSleep) {
|
||||
interruptiveSleep.interrupt()
|
||||
}
|
||||
}
|
||||
|
||||
public sleep(key: string, ms: number): Promise<void> {
|
||||
if (!this.interruptiveSleep.has(key)) {
|
||||
this.interruptiveSleep.set(key, new InterruptiveSleep(this.stepSizeMilliseconds))
|
||||
}
|
||||
const interruptiveSleep = this.interruptiveSleep.get(key)
|
||||
if (!interruptiveSleep) {
|
||||
throw new LogError('map entry not exist after setting it')
|
||||
}
|
||||
return interruptiveSleep.sleep(ms)
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user