Skip to content

Instantly share code, notes, and snippets.

View witalobenicio's full-sized avatar

Witalo Benicio witalobenicio

  • Nexla
View GitHub Profile
export default function useQiProposalActions({
contractId,
qiProposalId,
qiActionProposalId,
}) {
const [
listProposalsControl,
listActionsControl,
listHistoricControl,
cancelControl,
export default function initializeProcessorSubscribers(): void {
const taskResultController = new TaskResultController();
ToDoProcessorQueue
.getInstance()
.subscribe(
taskResultController.onSuccess,
taskResultController.onError
);
}
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();
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 {
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 {
import {
ChangeMessageVisibilityCommand,
ChangeMessageVisibilityCommandOutput,
DeleteMessageCommand,
DeleteMessageCommandOutput,
Message,
ReceiveMessageCommand,
SendMessageBatchCommand,
SendMessageBatchRequestEntry,
SendMessageCommand,
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;
}
export interface IQueue {
getUrl(): string;
getPriorityQueue(): IQueue;
}
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"
@witalobenicio
witalobenicio / flattenArray.js
Last active October 24, 2019 16:23
Deeply Flatt Array
// @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];