1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-11-10 12:35:46 +03:00

🐛 Fix bug that it did load same executions multiple times

This commit is contained in:
Jan Oberhauser 2019-12-12 20:57:11 +01:00
parent d74f0d9bbd
commit 870961b101
4 changed files with 9 additions and 9 deletions

View File

@ -853,8 +853,8 @@ class App {
}
const countFilter = JSON.parse(JSON.stringify(filter));
if (req.query.lastStartedAt) {
filter.startedAt = LessThan(req.query.lastStartedAt);
if (req.query.lastId) {
filter.id = LessThan(req.query.lastId);
}
countFilter.select = ['id'];
@ -871,7 +871,7 @@ class App {
],
where: filter,
order: {
startedAt: "DESC",
id: 'DESC',
},
take: limit,
});

View File

@ -120,7 +120,7 @@ export interface IRestApi {
getActiveWorkflows(): Promise<string[]>;
getActivationError(id: string): Promise<IActivationError | undefined >;
getCurrentExecutions(filter: object): Promise<IExecutionsCurrentSummaryExtended[]>;
getPastExecutions(filter: object, limit: number, lastStartedAt?: Date): Promise<IExecutionsListResponse>;
getPastExecutions(filter: object, limit: number, lastId?: string | number): Promise<IExecutionsListResponse>;
stopCurrentExecution(executionId: string): Promise<IExecutionsStopData>;
makeRestApiRequest(method: string, endpoint: string, data?: any): Promise<any>; // tslint:disable-line:no-any
getSettings(): Promise<IN8nUISettings>;

View File

@ -333,16 +333,16 @@ export default mixins(
this.isDataLoading = true;
const filter = this.workflowFilter;
let lastStartedAt: Date | undefined;
let lastId: string | number | undefined;
if (this.finishedExecutions.length !== 0) {
const lastItem = this.finishedExecutions.slice(-1)[0];
lastStartedAt = lastItem.startedAt as Date;
lastId = lastItem.id;
}
let data: IExecutionsListResponse;
try {
data = await this.restApi().getPastExecutions(filter, this.requestItemsPerRequest, lastStartedAt);
data = await this.restApi().getPastExecutions(filter, this.requestItemsPerRequest, lastId);
} catch (error) {
this.isDataLoading = false;
this.$showError(error, 'Problem loading workflows', 'There was a problem loading the workflows:');

View File

@ -269,12 +269,12 @@ export const restApi = Vue.extend({
// Returns all saved executions
// TODO: For sure needs some kind of default filter like last day, with max 10 results, ...
getPastExecutions: (filter: object, limit: number, lastStartedAt?: Date): Promise<IExecutionsListResponse> => {
getPastExecutions: (filter: object, limit: number, lastId?: string | number): Promise<IExecutionsListResponse> => {
let sendData = {};
if (filter) {
sendData = {
filter,
lastStartedAt,
lastId,
limit,
};
}