This file contains hidden or 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
function witaloFlatten(arr) { | |
return arr.reduce((flat, next) => | |
flat.concat(Array.isArray(next) ? witaloFlatten(next) : next), []); | |
} |
This file contains hidden or 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
// @flow | |
const flattenDeep = (arr: Array<number>], flatArr = []) => { | |
const length = !arr ? 0 : arr.length; | |
let index = 0; | |
while(index < length) { | |
if (Array.isArray(arr[index])) { | |
flatDeep(arr[index], flatArr); | |
} else { | |
flattArr[flattenArr.length] = arr[index]; |
This file contains hidden or 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
import * as React from "react" | |
function SvgComponent(props) { | |
return ( | |
<svg | |
id="prefix__Camada_1" | |
x={0} | |
y={0} | |
viewBox="0 0 560 395.7" | |
xmlSpace="preserve" |
This file contains hidden or 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
export interface IQueue { | |
getUrl(): string; | |
getPriorityQueue(): IQueue; | |
} |
This file contains hidden or 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
import { IQueue } from '@managers/queue/types/Queue'; | |
import QueuePriorityToDo from '@queue/types/QueuePriorityToDo'; | |
class QueueToDo implements IQueue { | |
private readonly url: string = '<your-queue-endpoint>'; | |
public getUrl(): string { | |
return this.url; | |
} |
This file contains hidden or 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
import { | |
ChangeMessageVisibilityCommand, | |
ChangeMessageVisibilityCommandOutput, | |
DeleteMessageCommand, | |
DeleteMessageCommandOutput, | |
Message, | |
ReceiveMessageCommand, | |
SendMessageBatchCommand, | |
SendMessageBatchRequestEntry, | |
SendMessageCommand, |
This file contains hidden or 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
import { Observable, Subject } from 'rxjs'; | |
import { DataCallback } from '@integrations/types'; | |
import { Task } from '@models/Task'; | |
export interface BatchChange { | |
used: number; | |
available: number; | |
} | |
export default abstract class Processor { |
This file contains hidden or 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
import { Observable } from 'rxjs'; | |
import { retry } from 'rxjs/operators'; | |
import Processor from './Processor'; | |
import { Task } from '@models/Task'; | |
const BATCH = 20; | |
export default class ToDoProcessorQueue extends Processor { | |
public static getInstance(): ToDoProcessorQueue { |
This file contains hidden or 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
import QueueManager from '@queue/QueueManager'; | |
import { MessagesManager } from '@managers/messages/MessagesManager'; | |
import TaskHandlerBuilder from '@workers/handlers/task/TaskHandlerBuilder'; | |
import { IQueue } from '@queue/types/Queue'; | |
import QueueToDo from '@queue/types/QueueToDo'; | |
import Processor from '@workers/processor/Processor'; | |
import ToDoProcessorQueue from '@workers/processor/ToDoProcessorQueue'; | |
export default () => { | |
checkForMessages(); |
This file contains hidden or 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
export default function initializeProcessorSubscribers(): void { | |
const taskResultController = new TaskResultController(); | |
ToDoProcessorQueue | |
.getInstance() | |
.subscribe( | |
taskResultController.onSuccess, | |
taskResultController.onError | |
); | |
} |
OlderNewer