Skip to content

Commit 167e212

Browse files
author
arthosofteq
authored
Merge pull request #1516 from RedisInsight/bugfix/prerelease-2.16.0
Bugfix/prerelease 2.16.0
2 parents c0195f4 + 1daa73d commit 167e212

File tree

7 files changed

+103
-18
lines changed

7 files changed

+103
-18
lines changed

.circleci/config.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,13 @@ jobs:
511511
- run:
512512
name: install dependencies
513513
command: |
514-
sudo apt-get update -y && sudo apt-get install -y rpm
514+
sudo apt-get update -y && sudo apt-get install -y rpm flatpak flatpak-builder ca-certificates
515+
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
516+
flatpak install flathub --no-deps --arch x86_64 --assumeyes \
517+
runtime/org.freedesktop.Sdk/x86_64/20.08 \
518+
runtime/org.freedesktop.Platform/x86_64/20.08 \
519+
org.electronjs.Electron2.BaseApp/x86_64/20.08
520+
515521
yarn --cwd redisinsight/api/ install
516522
yarn install
517523
yarn build:statics
@@ -554,6 +560,8 @@ jobs:
554560
- release/RedisInsight*.deb
555561
- release/RedisInsight*.rpm
556562
- release/RedisInsight*.AppImage
563+
- release/RedisInsight*.flatpak
564+
- release/RedisInsight*.snap
557565
- release/*-linux.yml
558566
- release/redisstack
559567
macosx:

electron-builder.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,17 @@
6464
"target": "deb",
6565
"arch": ["x64"]
6666
},
67+
{
68+
"target": "flatpak",
69+
"arch": ["x64"]
70+
},
6771
{
6872
"target": "rpm",
6973
"arch": ["x64"]
74+
},
75+
{
76+
"target": "snap",
77+
"arch": ["x64"]
7078
}
7179
],
7280
"synopsis": "Redis GUI by Redis Ltd.",
@@ -78,6 +86,49 @@
7886
"Comment": "Redis GUI by Redis Ltd"
7987
}
8088
},
89+
"snap": {
90+
"plugs": [
91+
"default",
92+
"password-manager-service"
93+
],
94+
"confinement": "strict",
95+
"stagePackages": ["default"]
96+
},
97+
"flatpak": {
98+
"runtimeVersion": "20.08",
99+
"modules": [
100+
{
101+
"name": "libsecret",
102+
"buildsystem": "meson",
103+
"config-opts": [
104+
"-Dmanpage=false",
105+
"-Dvapi=false",
106+
"-Dgtk_doc=false",
107+
"-Dintrospection=false"
108+
],
109+
"cleanup": ["/bin", "/include", "/lib/pkgconfig", "/share/man"],
110+
"sources": [
111+
{
112+
"type": "archive",
113+
"url": "https://download.gnome.org/sources/libsecret/0.20/libsecret-0.20.5.tar.xz",
114+
"sha256": "3fb3ce340fcd7db54d87c893e69bfc2b1f6e4d4b279065ffe66dac9f0fd12b4d"
115+
}
116+
]
117+
}
118+
],
119+
"finishArgs": [
120+
"--share=ipc",
121+
"--share=network",
122+
"--filesystem=home",
123+
"--device=dri",
124+
"--talk-name=org.freedesktop.secrets",
125+
"--talk-name=org.freedesktop.Notifications",
126+
"--talk-name=org.freedesktop.Flatpak",
127+
"--socket=fallback-x11",
128+
"--socket=wayland",
129+
"--socket=x11"
130+
]
131+
},
81132
"directories": {
82133
"app": "redisinsight",
83134
"buildResources": "resources",

redisinsight/api/src/modules/browser/services/keys-business/scanner/strategies/standalone.strategy.spec.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,17 @@ describe('Standalone Scanner Strategy', () => {
229229
]);
230230
expect(strategy.getKeysInfo).toHaveBeenCalledTimes(0);
231231
});
232-
it('should not call scan when total is 0', async () => {
233-
jest.spyOn(Utils, 'getTotal').mockResolvedValue(mockGetTotalResponse_3);
232+
it('should call scan N times until threshold exceeds (even when total 0)', async () => {
233+
jest.spyOn(Utils, 'getTotal').mockResolvedValue(0);
234+
235+
when(browserTool.execCommand)
236+
.calledWith(
237+
mockBrowserClientMetadata,
238+
BrowserToolKeysCommands.Scan,
239+
expect.anything(),
240+
null,
241+
)
242+
.mockResolvedValue(['1', []]);
234243

235244
strategy.getKeysInfo = jest.fn().mockResolvedValue([]);
236245

@@ -239,10 +248,16 @@ describe('Standalone Scanner Strategy', () => {
239248
expect(result).toEqual([
240249
{
241250
...mockNodeEmptyResult,
251+
cursor: 1,
252+
total: null,
253+
scanned:
254+
Math.trunc(REDIS_SCAN_CONFIG.countThreshold / getKeysDto.count)
255+
* getKeysDto.count
256+
+ getKeysDto.count,
257+
keys: [],
242258
},
243259
]);
244-
expect(browserTool.execCommand).toBeCalledTimes(0);
245-
expect(strategy.getKeysInfo).toBeCalledTimes(0);
260+
expect(strategy.getKeysInfo).toHaveBeenCalledTimes(0);
246261
});
247262
it('should call scan with required args', async () => {
248263
jest.spyOn(Utils, 'getTotal').mockResolvedValue(mockGetTotalResponse_3);

redisinsight/api/src/modules/browser/services/keys-business/scanner/strategies/standalone.strategy.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ export class StandaloneStrategy extends AbstractStrategy {
7272
node.keys = node.keys.map((name) => ({ name }));
7373
}
7474

75+
// workaround for "pika" databases
76+
if (!node.total && (node.cursor > 0 || node.keys?.length)) {
77+
node.total = null;
78+
}
79+
7580
return [node];
7681
}
7782

@@ -86,12 +91,11 @@ export class StandaloneStrategy extends AbstractStrategy {
8691
// todo: remove settings from here. threshold should be part of query?
8792
const settings = await this.settingsService.getAppSettings('1');
8893
while (
89-
(node.total > 0 || isNull(node.total))
94+
(node.total >= 0 || isNull(node.total))
9095
&& !fullScanned
9196
&& node.keys.length < count
9297
&& (
93-
(node.total < settings.scanThreshold && node.cursor)
94-
|| node.scanned < settings.scanThreshold
98+
node.scanned < settings.scanThreshold
9599
)
96100
) {
97101
let commandArgs = [`${node.cursor}`, 'MATCH', match, 'COUNT', count];

redisinsight/api/src/modules/database-analysis/database-analysis.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ export class DatabaseAnalysisService {
2929
clientMetadata: ClientMetadata,
3030
dto: CreateDatabaseAnalysisDto,
3131
): Promise<DatabaseAnalysis> {
32+
let client;
33+
3234
try {
33-
const client = await this.databaseConnectionService.createClient(clientMetadata);
35+
client = await this.databaseConnectionService.createClient(clientMetadata);
3436

3537
const scanResults = await this.scanner.scan(client, {
3638
filter: dto.filter,
@@ -54,8 +56,10 @@ export class DatabaseAnalysisService {
5456
progress,
5557
}, [].concat(...scanResults.map((nodeResult) => nodeResult.keys))));
5658

59+
client.disconnect();
5760
return this.databaseAnalysisProvider.create(analysis);
5861
} catch (e) {
62+
client?.disconnect();
5963
this.logger.error('Unable to analyze database', e);
6064

6165
if (e instanceof HttpException) {

redisinsight/api/src/modules/server/server.service.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,18 @@ export class ServerService implements OnApplicationBootstrap {
5252
appType: this.getAppType(SERVER_CONFIG.buildType),
5353
});
5454

55-
this.eventEmitter.emit(AppAnalyticsEvents.Track, {
56-
event: startEvent,
57-
eventData: {
58-
appVersion: SERVER_CONFIG.appVersion,
59-
osPlatform: process.platform,
60-
buildType: SERVER_CONFIG.buildType,
61-
},
62-
nonTracking: true,
63-
});
55+
// do not track start events for non-electron builds
56+
if (SERVER_CONFIG?.buildType.toUpperCase() === 'ELECTRON') {
57+
this.eventEmitter.emit(AppAnalyticsEvents.Track, {
58+
event: startEvent,
59+
eventData: {
60+
appVersion: SERVER_CONFIG.appVersion,
61+
osPlatform: process.platform,
62+
buildType: SERVER_CONFIG.buildType,
63+
},
64+
nonTracking: true,
65+
});
66+
}
6467
}
6568

6669
/**

resources/icons/1024x1024.png

-99.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)