Browse Source

1) Cache removed

2) Angular updated
3) Migration fixed.
pull/206/head
Sebastian Stehle 8 years ago
parent
commit
37cd269e87
  1. 1
      src/Squidex/app/framework/declarations.ts
  2. 2
      src/Squidex/app/framework/module.ts
  3. 64
      src/Squidex/app/framework/services/local-cache.service.spec.ts
  4. 61
      src/Squidex/app/framework/services/local-cache.service.ts
  5. 25
      src/Squidex/app/shared/services/assets.service.spec.ts
  6. 21
      src/Squidex/app/shared/services/assets.service.ts
  7. 43
      src/Squidex/app/shared/services/contents.service.spec.ts
  8. 23
      src/Squidex/app/shared/services/contents.service.ts
  9. 25
      src/Squidex/app/shared/services/schemas.service.spec.ts
  10. 23
      src/Squidex/app/shared/services/schemas.service.ts
  11. 42
      src/Squidex/package.json
  12. 6
      tools/Migrate_01/Migration01.cs

1
src/Squidex/app/framework/declarations.ts

@ -56,7 +56,6 @@ export * from './services/analytics.service';
export * from './services/clipboard.service'; export * from './services/clipboard.service';
export * from './services/dialog.service'; export * from './services/dialog.service';
export * from './services/local-store.service'; export * from './services/local-store.service';
export * from './services/local-cache.service';
export * from './services/message-bus.service'; export * from './services/message-bus.service';
export * from './services/onboarding.service'; export * from './services/onboarding.service';
export * from './services/resource-loader.service'; export * from './services/resource-loader.service';

2
src/Squidex/app/framework/module.ts

@ -39,7 +39,6 @@ import {
JsonEditorComponent, JsonEditorComponent,
KeysPipe, KeysPipe,
KNumberPipe, KNumberPipe,
LocalCacheService,
LocalStoreService, LocalStoreService,
LowerCaseInputDirective, LowerCaseInputDirective,
MarkdownEditorComponent, MarkdownEditorComponent,
@ -197,7 +196,6 @@ export class SqxFrameworkModule {
CanDeactivateGuard, CanDeactivateGuard,
ClipboardService, ClipboardService,
DialogService, DialogService,
LocalCacheService,
LocalStoreService, LocalStoreService,
MessageBus, MessageBus,
OnboardingService, OnboardingService,

64
src/Squidex/app/framework/services/local-cache.service.spec.ts

@ -1,64 +0,0 @@
/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Sebastian Stehle. All rights reserved
*/
import { LocalCacheService, LocalCacheServiceFactory } from './../';
describe('LocalCache', () => {
it('should instantiate from factory', () => {
const localCacheService = LocalCacheServiceFactory();
expect(localCacheService).toBeDefined();
});
it('should instantiate', () => {
const localCacheService = new LocalCacheService();
expect(localCacheService).toBeDefined();
});
it('should get and store item in cache', () => {
const localCacheService = new LocalCacheService();
const value = {};
localCacheService.set('key', value);
expect(localCacheService.get('key')).toBe(value);
});
it('should not retrieve item if cleared', () => {
const localCacheService = new LocalCacheService();
const value = {};
localCacheService.set('key', value);
localCacheService.clear(true);
expect(localCacheService.get('key')).toBeUndefined();
});
it('should not retrieve item if removed', () => {
const localCacheService = new LocalCacheService();
const value = {};
localCacheService.set('key', value);
localCacheService.remove('key');
expect(localCacheService.get('key')).toBeUndefined();
});
it('should not retrieve item if expired', () => {
const localCacheService = new LocalCacheService();
const value = {};
localCacheService.set('key', value);
expect(localCacheService.get('key', new Date().getTime() + 400)).toBeUndefined();
});
});

61
src/Squidex/app/framework/services/local-cache.service.ts

@ -1,61 +0,0 @@
/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Sebastian Stehle. All rights reserved
*/
import { Injectable } from '@angular/core';
interface Entry { value: any; expires: number; }
export const LocalCacheServiceFactory = () => {
return new LocalCacheService();
};
@Injectable()
export class LocalCacheService {
private readonly entries: { [key: string]: Entry } = {};
public clear(force: boolean) {
const now = new Date().getTime();
for (let key in this.entries) {
if (this.entries.hasOwnProperty(key)) {
const entry = this.entries[key];
if (force || LocalCacheService.isExpired(now, entry)) {
delete this.entries[key];
}
}
}
}
public get<T>(key: string, now?: number): T | undefined {
const entry = this.entries[key];
if (entry) {
now = now || new Date().getTime();
if (!LocalCacheService.isExpired(now, entry)) {
delete this.entries[key];
return <T> entry.value;
}
}
return undefined;
}
public set<T>(key: string, value: T, expiresIn = 100) {
this.entries[key] = { value, expires: new Date().getTime() + expiresIn };
}
public remove(key: string) {
delete this.entries[key];
}
private static isExpired(now: number, entry: Entry): boolean {
return entry.expires < now;
}
}

25
src/Squidex/app/shared/services/assets.service.spec.ts

@ -16,7 +16,6 @@ import {
AssetReplacedDto, AssetReplacedDto,
AssetsService, AssetsService,
DateTime, DateTime,
LocalCacheService,
UpdateAssetDto, UpdateAssetDto,
Version, Version,
Versioned Versioned
@ -70,7 +69,6 @@ describe('AssetsService', () => {
], ],
providers: [ providers: [
AssetsService, AssetsService,
LocalCacheService,
{ provide: ApiUrlConfig, useValue: new ApiUrlConfig('http://service/p/') }, { provide: ApiUrlConfig, useValue: new ApiUrlConfig('http://service/p/') },
{ provide: AnalyticsService, useValue: new AnalyticsService() } { provide: AnalyticsService, useValue: new AnalyticsService() }
] ]
@ -216,29 +214,6 @@ describe('AssetsService', () => {
new Version('2'))); new Version('2')));
})); }));
it('should provide entry from cache if not found',
inject([LocalCacheService, AssetsService, HttpTestingController], (localCache: LocalCacheService, assetsService: AssetsService, httpMock: HttpTestingController) => {
const cached = {};
localCache.set('asset.123', cached, 10000);
let asset: AssetDto | null = null;
assetsService.getAsset('my-app', '123').subscribe(result => {
asset = result;
});
const req = httpMock.expectOne('http://service/p/api/apps/my-app/assets/123');
expect(req.request.method).toEqual('GET');
expect(req.request.headers.get('If-Match')).toBeNull();
req.flush({}, { status: 404, statusText: '404' });
expect(asset).toBe(cached);
}));
it('should append query to find by name', it('should append query to find by name',
inject([AssetsService, HttpTestingController], (assetsService: AssetsService, httpMock: HttpTestingController) => { inject([AssetsService, HttpTestingController], (assetsService: AssetsService, httpMock: HttpTestingController) => {

21
src/Squidex/app/shared/services/assets.service.ts

@ -5,7 +5,7 @@
* Copyright (c) Sebastian Stehle. All rights reserved * Copyright (c) Sebastian Stehle. All rights reserved
*/ */
import { HttpClient, HttpErrorResponse, HttpEventType, HttpHeaders, HttpRequest, HttpResponse } from '@angular/common/http'; import { HttpClient, HttpEventType, HttpHeaders, HttpRequest, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
@ -13,7 +13,6 @@ import {
AnalyticsService, AnalyticsService,
ApiUrlConfig, ApiUrlConfig,
DateTime, DateTime,
LocalCacheService,
HTTP, HTTP,
Version, Version,
Versioned Versioned
@ -106,8 +105,7 @@ export class AssetsService {
constructor( constructor(
private readonly http: HttpClient, private readonly http: HttpClient,
private readonly apiUrl: ApiUrlConfig, private readonly apiUrl: ApiUrlConfig,
private readonly analytics: AnalyticsService, private readonly analytics: AnalyticsService
private readonly localCache: LocalCacheService
) { ) {
} }
@ -202,8 +200,6 @@ export class AssetsService {
assetUrl, assetUrl,
new Version(event.headers.get('etag'))); new Version(event.headers.get('etag')));
this.localCache.set(`asset.${dto.id}`, dto, 5000);
return dto; return dto;
} }
}) })
@ -239,17 +235,6 @@ export class AssetsService {
assetUrl, assetUrl,
response.version); response.version);
}) })
.catch(error => {
if (error instanceof HttpErrorResponse && error.status === 404) {
const cached = this.localCache.get(`asset.${id}`);
if (cached) {
return Observable.of(cached);
}
}
return Observable.throw(error);
})
.pretifyError('Failed to load assets. Please reload.'); .pretifyError('Failed to load assets. Please reload.');
} }
@ -298,8 +283,6 @@ export class AssetsService {
return HTTP.deleteVersioned(this.http, url, version) return HTTP.deleteVersioned(this.http, url, version)
.do(() => { .do(() => {
this.analytics.trackEvent('Analytics', 'Deleted', appName); this.analytics.trackEvent('Analytics', 'Deleted', appName);
this.localCache.remove(`asset.${id}`);
}) })
.pretifyError('Failed to delete asset. Please reload.'); .pretifyError('Failed to delete asset. Please reload.');
} }

43
src/Squidex/app/shared/services/contents.service.spec.ts

@ -15,7 +15,6 @@ import {
ContentsDto, ContentsDto,
ContentsService, ContentsService,
DateTime, DateTime,
LocalCacheService,
Version Version
} from './../'; } from './../';
@ -97,7 +96,6 @@ describe('ContentsService', () => {
], ],
providers: [ providers: [
ContentsService, ContentsService,
LocalCacheService,
{ provide: ApiUrlConfig, useValue: new ApiUrlConfig('http://service/p/') }, { provide: ApiUrlConfig, useValue: new ApiUrlConfig('http://service/p/') },
{ provide: AnalyticsService, useValue: new AnalyticsService() } { provide: AnalyticsService, useValue: new AnalyticsService() }
] ]
@ -166,11 +164,7 @@ describe('ContentsService', () => {
it('should append query to get request as search', it('should append query to get request as search',
inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => { inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => {
let contents: ContentsDto | null = null; contentsService.getContents('my-app', 'my-schema', 17, 13, 'my-query').subscribe();
contentsService.getContents('my-app', 'my-schema', 17, 13, 'my-query').subscribe(result => {
contents = result;
});
const req = httpMock.expectOne('http://service/p/api/content/my-app/my-schema?$search="my-query"&$top=17&$skip=13'); const req = httpMock.expectOne('http://service/p/api/content/my-app/my-schema?$search="my-query"&$top=17&$skip=13');
@ -183,11 +177,7 @@ describe('ContentsService', () => {
it('should append ids to get request with ids', it('should append ids to get request with ids',
inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => { inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => {
let contents: ContentsDto | null = null; contentsService.getContents('my-app', 'my-schema', 17, 13, undefined, ['id1', 'id2']).subscribe();
contentsService.getContents('my-app', 'my-schema', 17, 13, undefined, ['id1', 'id2']).subscribe(result => {
contents = result;
});
const req = httpMock.expectOne('http://service/p/api/content/my-app/my-schema?$top=17&$skip=13&ids=id1,id2'); const req = httpMock.expectOne('http://service/p/api/content/my-app/my-schema?$top=17&$skip=13&ids=id1,id2');
@ -200,11 +190,7 @@ describe('ContentsService', () => {
it('should append query to get request as plain query string', it('should append query to get request as plain query string',
inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => { inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => {
let contents: ContentsDto | null = null; contentsService.getContents('my-app', 'my-schema', 17, 13, '$filter=my-filter').subscribe();
contentsService.getContents('my-app', 'my-schema', 17, 13, '$filter=my-filter').subscribe(result => {
contents = result;
});
const req = httpMock.expectOne('http://service/p/api/content/my-app/my-schema?$filter=my-filter&$top=17&$skip=13'); const req = httpMock.expectOne('http://service/p/api/content/my-app/my-schema?$filter=my-filter&$top=17&$skip=13');
@ -250,29 +236,6 @@ describe('ContentsService', () => {
new Version('2'))); new Version('2')));
})); }));
it('should provide entry from cache if not found',
inject([LocalCacheService, ContentsService, HttpTestingController], (localCache: LocalCacheService, contentsService: ContentsService, httpMock: HttpTestingController) => {
const cached = {};
localCache.set('content.1', cached, 10000);
let content: ContentDto | null = null;
contentsService.getContent('my-app', 'my-schema', '1').subscribe(result => {
content = result;
});
const req = httpMock.expectOne('http://service/p/api/content/my-app/my-schema/1');
expect(req.request.method).toEqual('GET');
expect(req.request.headers.get('If-Match')).toBeNull();
req.flush({}, { status: 404, statusText: '404' });
expect(content).toBe(cached);
}));
it('should make post request to create content', it('should make post request to create content',
inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => { inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => {

23
src/Squidex/app/shared/services/contents.service.ts

@ -5,7 +5,7 @@
* Copyright (c) Sebastian Stehle. All rights reserved * Copyright (c) Sebastian Stehle. All rights reserved
*/ */
import { HttpClient, HttpErrorResponse } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
@ -15,7 +15,6 @@ import {
AnalyticsService, AnalyticsService,
ApiUrlConfig, ApiUrlConfig,
DateTime, DateTime,
LocalCacheService,
HTTP, HTTP,
Version, Version,
Versioned Versioned
@ -96,8 +95,7 @@ export class ContentsService {
constructor( constructor(
private readonly http: HttpClient, private readonly http: HttpClient,
private readonly apiUrl: ApiUrlConfig, private readonly apiUrl: ApiUrlConfig,
private readonly analytics: AnalyticsService, private readonly analytics: AnalyticsService
private readonly localCache: LocalCacheService
) { ) {
} }
@ -172,17 +170,6 @@ export class ContentsService {
body.data, body.data,
response.version); response.version);
}) })
.catch(error => {
if (error instanceof HttpErrorResponse && error.status === 404) {
const cached = this.localCache.get(`content.${id}`);
if (cached) {
return Observable.of(cached);
}
}
return Observable.throw(error);
})
.pretifyError('Failed to load content. Please reload.'); .pretifyError('Failed to load content. Please reload.');
} }
@ -215,8 +202,6 @@ export class ContentsService {
}) })
.do(content => { .do(content => {
this.analytics.trackEvent('Content', 'Created', appName); this.analytics.trackEvent('Content', 'Created', appName);
this.localCache.set(`content.${content.id}`, content, 5000);
}) })
.pretifyError('Failed to create content. Please reload.'); .pretifyError('Failed to create content. Please reload.');
} }
@ -232,8 +217,6 @@ export class ContentsService {
}) })
.do(() => { .do(() => {
this.analytics.trackEvent('Content', 'Updated', appName); this.analytics.trackEvent('Content', 'Updated', appName);
this.localCache.set(`content.${id}`, dto, 5000);
}) })
.pretifyError('Failed to update content. Please reload.'); .pretifyError('Failed to update content. Please reload.');
} }
@ -244,8 +227,6 @@ export class ContentsService {
return HTTP.deleteVersioned(this.http, url, version) return HTTP.deleteVersioned(this.http, url, version)
.do(() => { .do(() => {
this.analytics.trackEvent('Content', 'Deleted', appName); this.analytics.trackEvent('Content', 'Deleted', appName);
this.localCache.remove(`content.${id}`);
}) })
.pretifyError('Failed to delete content. Please reload.'); .pretifyError('Failed to delete content. Please reload.');
} }

25
src/Squidex/app/shared/services/schemas.service.spec.ts

@ -16,7 +16,6 @@ import {
createProperties, createProperties,
DateTime, DateTime,
FieldDto, FieldDto,
LocalCacheService,
SchemaDetailsDto, SchemaDetailsDto,
SchemaDto, SchemaDto,
SchemaPropertiesDto, SchemaPropertiesDto,
@ -197,7 +196,6 @@ describe('SchemasService', () => {
HttpClientTestingModule HttpClientTestingModule
], ],
providers: [ providers: [
LocalCacheService,
SchemasService, SchemasService,
{ provide: ApiUrlConfig, useValue: new ApiUrlConfig('http://service/p/') }, { provide: ApiUrlConfig, useValue: new ApiUrlConfig('http://service/p/') },
{ provide: AnalyticsService, useValue: new AnalyticsService() } { provide: AnalyticsService, useValue: new AnalyticsService() }
@ -433,29 +431,6 @@ describe('SchemasService', () => {
'<script-change>')); '<script-change>'));
})); }));
it('should provide entry from cache if not found',
inject([LocalCacheService, SchemasService, HttpTestingController], (localCache: LocalCacheService, schemasService: SchemasService, httpMock: HttpTestingController) => {
const cached = {};
localCache.set('schema.my-app.my-schema', cached, 10000);
let schema: SchemaDetailsDto | null = null;
schemasService.getSchema('my-app', 'my-schema').subscribe(result => {
schema = result;
});
const req = httpMock.expectOne('http://service/p/api/apps/my-app/schemas/my-schema');
expect(req.request.method).toEqual('GET');
expect(req.request.headers.get('If-Match')).toBeNull();
req.flush({}, { status: 404, statusText: '404' });
expect(schema).toBe(cached);
}));
it('should make post request to create schema', it('should make post request to create schema',
inject([SchemasService, HttpTestingController], (schemasService: SchemasService, httpMock: HttpTestingController) => { inject([SchemasService, HttpTestingController], (schemasService: SchemasService, httpMock: HttpTestingController) => {

23
src/Squidex/app/shared/services/schemas.service.ts

@ -5,7 +5,7 @@
* Copyright (c) Sebastian Stehle. All rights reserved * Copyright (c) Sebastian Stehle. All rights reserved
*/ */
import { HttpClient, HttpErrorResponse } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ValidatorFn, Validators } from '@angular/forms'; import { ValidatorFn, Validators } from '@angular/forms';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
@ -16,7 +16,6 @@ import {
AnalyticsService, AnalyticsService,
ApiUrlConfig, ApiUrlConfig,
DateTime, DateTime,
LocalCacheService,
HTTP, HTTP,
ValidatorsEx, ValidatorsEx,
Version, Version,
@ -786,8 +785,7 @@ export class SchemasService {
constructor( constructor(
private readonly http: HttpClient, private readonly http: HttpClient,
private readonly apiUrl: ApiUrlConfig, private readonly apiUrl: ApiUrlConfig,
private readonly analytics: AnalyticsService, private readonly analytics: AnalyticsService
private readonly localCache: LocalCacheService
) { ) {
} }
@ -858,17 +856,6 @@ export class SchemasService {
body.scriptDelete, body.scriptDelete,
body.scriptChange); body.scriptChange);
}) })
.catch(error => {
if (error instanceof HttpErrorResponse && error.status === 404) {
const cached = this.localCache.get(`schema.${appName}.${id}`);
if (cached) {
return Observable.of(cached);
}
}
return Observable.throw(error);
})
.pretifyError('Failed to load schema. Please reload.'); .pretifyError('Failed to load schema. Please reload.');
} }
@ -900,9 +887,6 @@ export class SchemasService {
}) })
.do(schema => { .do(schema => {
this.analytics.trackEvent('Schema', 'Created', appName); this.analytics.trackEvent('Schema', 'Created', appName);
this.localCache.set(`schema.${appName}.${schema.id}`, schema, 5000);
this.localCache.set(`schema.${appName}.${schema.name}`, schema, 5000);
}) })
.pretifyError('Failed to create schema. Please reload.'); .pretifyError('Failed to create schema. Please reload.');
} }
@ -935,9 +919,6 @@ export class SchemasService {
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}`); const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}`);
return HTTP.deleteVersioned(this.http, url, version) return HTTP.deleteVersioned(this.http, url, version)
.do(() => {
this.localCache.remove(`schema.${appName}.${schemaName}`);
})
.do(() => { .do(() => {
this.analytics.trackEvent('Schema', 'Deleted', appName); this.analytics.trackEvent('Schema', 'Deleted', appName);
}) })

42
src/Squidex/package.json

@ -15,36 +15,36 @@
"build:clean": "rimraf wwwroot/build" "build:clean": "rimraf wwwroot/build"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "5.0.5", "@angular/animations": "5.1.0",
"@angular/common": "5.0.5", "@angular/common": "5.1.0",
"@angular/compiler": "5.0.5", "@angular/compiler": "5.1.0",
"@angular/core": "5.0.5", "@angular/core": "5.1.0",
"@angular/forms": "5.0.5", "@angular/forms": "5.1.0",
"@angular/http": "5.0.5", "@angular/http": "5.1.0",
"@angular/platform-browser": "5.0.5", "@angular/platform-browser": "5.1.0",
"@angular/platform-browser-dynamic": "5.0.5", "@angular/platform-browser-dynamic": "5.1.0",
"@angular/platform-server": "5.0.5", "@angular/platform-server": "5.1.0",
"@angular/router": "5.0.5", "@angular/router": "5.1.0",
"angular2-chartjs": "0.4.1", "angular2-chartjs": "0.4.1",
"babel-polyfill": "6.26.0", "babel-polyfill": "6.26.0",
"bootstrap": "4.0.0-alpha.6", "bootstrap": "4.0.0-alpha.6",
"core-js": "2.5.1", "core-js": "2.5.3",
"graphiql": "0.11.10", "graphiql": "0.11.10",
"moment": "2.19.3", "moment": "2.19.4",
"mousetrap": "1.6.1", "mousetrap": "1.6.1",
"ng2-dnd": "5.0.2", "ng2-dnd": "5.0.2",
"oidc-client": "1.4.1", "oidc-client": "1.4.1",
"pikaday": "1.6.1", "pikaday": "1.7.0",
"progressbar.js": "1.0.1", "progressbar.js": "1.0.1",
"react": "16.2.0", "react": "16.2.0",
"react-dom": "16.2.0", "react-dom": "16.2.0",
"rxjs": "5.5.2", "rxjs": "5.5.5",
"zone.js": "0.8.18" "zone.js": "0.8.18"
}, },
"devDependencies": { "devDependencies": {
"@angular/compiler": "5.0.5", "@angular/compiler": "5.1.0",
"@angular/compiler-cli": "5.0.5", "@angular/compiler-cli": "5.1.0",
"@ngtools/webpack": "1.8.5", "@ngtools/webpack": "1.9.0",
"@types/core-js": "0.9.35", "@types/core-js": "0.9.35",
"@types/jasmine": "2.5.45", "@types/jasmine": "2.5.45",
"@types/mousetrap": "1.5.34", "@types/mousetrap": "1.5.34",
@ -54,7 +54,7 @@
"angular2-router-loader": "0.3.5", "angular2-router-loader": "0.3.5",
"angular2-template-loader": "0.6.2", "angular2-template-loader": "0.6.2",
"awesome-typescript-loader": "3.4.1", "awesome-typescript-loader": "3.4.1",
"codelyzer": "4.0.1", "codelyzer": "4.0.2",
"cpx": "1.5.0", "cpx": "1.5.0",
"css-loader": "0.28.7", "css-loader": "0.28.7",
"exports-loader": "0.6.4", "exports-loader": "0.6.4",
@ -88,10 +88,10 @@
"tslint": "5.8.0", "tslint": "5.8.0",
"tslint-loader": "3.5.3", "tslint-loader": "3.5.3",
"typemoq": "2.1.0", "typemoq": "2.1.0",
"typescript": "2.4.2", "typescript": "2.5.3",
"underscore": "1.8.3", "underscore": "1.8.3",
"webpack": "3.9.1", "webpack": "3.10.0",
"webpack-dev-server": "2.9.5", "webpack-dev-server": "2.9.7",
"webpack-merge": "4.1.1" "webpack-merge": "4.1.1"
} }
} }

6
tools/Migrate_01/Migration01.cs

@ -56,9 +56,15 @@ namespace Migrate_01
{ {
var subscription = eventStore.CreateSubscription(this, ".*"); var subscription = eventStore.CreateSubscription(this, ".*");
try
{
await subscriptionTcs.Task; await subscriptionTcs.Task;
}
finally
{
await subscription.StopAsync(); await subscription.StopAsync();
} }
}
public async Task OnEventAsync(IEventSubscription subscription, StoredEvent storedEvent) public async Task OnEventAsync(IEventSubscription subscription, StoredEvent storedEvent)
{ {

Loading…
Cancel
Save