Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,13 @@ jobs:
- run:
name: install dependencies
command: |
sudo apt-get update -y && sudo apt-get install -y rpm
sudo apt-get update -y && sudo apt-get install -y rpm flatpak flatpak-builder ca-certificates
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install flathub --no-deps --arch x86_64 --assumeyes \
runtime/org.freedesktop.Sdk/x86_64/20.08 \
runtime/org.freedesktop.Platform/x86_64/20.08 \
org.electronjs.Electron2.BaseApp/x86_64/20.08

yarn --cwd redisinsight/api/ install
yarn install
yarn build:statics
Expand Down Expand Up @@ -554,6 +560,8 @@ jobs:
- release/RedisInsight*.deb
- release/RedisInsight*.rpm
- release/RedisInsight*.AppImage
- release/RedisInsight*.flatpak
- release/RedisInsight*.snap
- release/*-linux.yml
- release/redisstack
macosx:
Expand Down
51 changes: 51 additions & 0 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,17 @@
"target": "deb",
"arch": ["x64"]
},
{
"target": "flatpak",
"arch": ["x64"]
},
{
"target": "rpm",
"arch": ["x64"]
},
{
"target": "snap",
"arch": ["x64"]
}
],
"synopsis": "Redis GUI by Redis Ltd.",
Expand All @@ -78,6 +86,49 @@
"Comment": "Redis GUI by Redis Ltd"
}
},
"snap": {
"plugs": [
"default",
"password-manager-service"
],
"confinement": "strict",
"stagePackages": ["default"]
},
"flatpak": {
"runtimeVersion": "20.08",
"modules": [
{
"name": "libsecret",
"buildsystem": "meson",
"config-opts": [
"-Dmanpage=false",
"-Dvapi=false",
"-Dgtk_doc=false",
"-Dintrospection=false"
],
"cleanup": ["/bin", "/include", "/lib/pkgconfig", "/share/man"],
"sources": [
{
"type": "archive",
"url": "https://download.gnome.org/sources/libsecret/0.20/libsecret-0.20.5.tar.xz",
"sha256": "3fb3ce340fcd7db54d87c893e69bfc2b1f6e4d4b279065ffe66dac9f0fd12b4d"
}
]
}
],
"finishArgs": [
"--share=ipc",
"--share=network",
"--filesystem=home",
"--device=dri",
"--talk-name=org.freedesktop.secrets",
"--talk-name=org.freedesktop.Notifications",
"--talk-name=org.freedesktop.Flatpak",
"--socket=fallback-x11",
"--socket=wayland",
"--socket=x11"
]
},
"directories": {
"app": "redisinsight",
"buildResources": "resources",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,17 @@ describe('Standalone Scanner Strategy', () => {
]);
expect(strategy.getKeysInfo).toHaveBeenCalledTimes(0);
});
it('should not call scan when total is 0', async () => {
jest.spyOn(Utils, 'getTotal').mockResolvedValue(mockGetTotalResponse_3);
it('should call scan N times until threshold exceeds (even when total 0)', async () => {
jest.spyOn(Utils, 'getTotal').mockResolvedValue(0);

when(browserTool.execCommand)
.calledWith(
mockBrowserClientMetadata,
BrowserToolKeysCommands.Scan,
expect.anything(),
null,
)
.mockResolvedValue(['1', []]);

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

Expand All @@ -239,10 +248,16 @@ describe('Standalone Scanner Strategy', () => {
expect(result).toEqual([
{
...mockNodeEmptyResult,
cursor: 1,
total: null,
scanned:
Math.trunc(REDIS_SCAN_CONFIG.countThreshold / getKeysDto.count)
* getKeysDto.count
+ getKeysDto.count,
keys: [],
},
]);
expect(browserTool.execCommand).toBeCalledTimes(0);
expect(strategy.getKeysInfo).toBeCalledTimes(0);
expect(strategy.getKeysInfo).toHaveBeenCalledTimes(0);
});
it('should call scan with required args', async () => {
jest.spyOn(Utils, 'getTotal').mockResolvedValue(mockGetTotalResponse_3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ export class StandaloneStrategy extends AbstractStrategy {
node.keys = node.keys.map((name) => ({ name }));
}

// workaround for "pika" databases
if (!node.total && (node.cursor > 0 || node.keys?.length)) {
node.total = null;
}

return [node];
}

Expand All @@ -86,12 +91,11 @@ export class StandaloneStrategy extends AbstractStrategy {
// todo: remove settings from here. threshold should be part of query?
const settings = await this.settingsService.getAppSettings('1');
while (
(node.total > 0 || isNull(node.total))
(node.total >= 0 || isNull(node.total))
&& !fullScanned
&& node.keys.length < count
&& (
(node.total < settings.scanThreshold && node.cursor)
|| node.scanned < settings.scanThreshold
node.scanned < settings.scanThreshold
)
) {
let commandArgs = [`${node.cursor}`, 'MATCH', match, 'COUNT', count];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ export class DatabaseAnalysisService {
clientMetadata: ClientMetadata,
dto: CreateDatabaseAnalysisDto,
): Promise<DatabaseAnalysis> {
let client;

try {
const client = await this.databaseConnectionService.createClient(clientMetadata);
client = await this.databaseConnectionService.createClient(clientMetadata);

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

client.disconnect();
return this.databaseAnalysisProvider.create(analysis);
} catch (e) {
client?.disconnect();
this.logger.error('Unable to analyze database', e);

if (e instanceof HttpException) {
Expand Down
21 changes: 12 additions & 9 deletions redisinsight/api/src/modules/server/server.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ export class ServerService implements OnApplicationBootstrap {
appType: this.getAppType(SERVER_CONFIG.buildType),
});

this.eventEmitter.emit(AppAnalyticsEvents.Track, {
event: startEvent,
eventData: {
appVersion: SERVER_CONFIG.appVersion,
osPlatform: process.platform,
buildType: SERVER_CONFIG.buildType,
},
nonTracking: true,
});
// do not track start events for non-electron builds
if (SERVER_CONFIG?.buildType.toUpperCase() === 'ELECTRON') {
this.eventEmitter.emit(AppAnalyticsEvents.Track, {
event: startEvent,
eventData: {
appVersion: SERVER_CONFIG.appVersion,
osPlatform: process.platform,
buildType: SERVER_CONFIG.buildType,
},
nonTracking: true,
});
}
}

/**
Expand Down
Binary file removed resources/icons/1024x1024.png
Binary file not shown.