increase timeouts and a few lint fixes

This commit is contained in:
dal 2025-07-21 15:39:27 -06:00
parent 0feb690bbe
commit 64992930a4
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
5 changed files with 23 additions and 26 deletions

View File

@ -15,11 +15,13 @@ pub async fn get_redshift_connection(credentials: &RedshiftCredentials) -> Resul
.username(credentials.username.as_str()) .username(credentials.username.as_str())
.password(credentials.password.as_str()) .password(credentials.password.as_str())
.database(&credentials.default_database) .database(&credentials.default_database)
.extra_float_digits(2); .extra_float_digits(2)
.connect_timeout(Duration::from_secs(60)); // 60 second connection timeout
let redshift_pool = match PgPoolOptions::new() let redshift_pool = match PgPoolOptions::new()
.max_connections(1) .max_connections(1)
.acquire_timeout(Duration::from_secs(5)) .acquire_timeout(Duration::from_secs(60)) // 60 second acquire timeout
.connect_timeout(Duration::from_secs(60)) // 60 second pool connection timeout
.connect_with(options) .connect_with(options)
.await .await
{ {

View File

@ -42,10 +42,7 @@ describe('delete-files-tool', () => {
it('should validate input schema correctly', () => { it('should validate input schema correctly', () => {
const validInput = { const validInput = {
files: [ files: [{ path: '/test/file1.txt' }, { path: '/test/file2.txt' }],
{ path: '/test/file1.txt' },
{ path: '/test/file2.txt' },
],
}; };
expect(() => deleteFiles.inputSchema.parse(validInput)).not.toThrow(); expect(() => deleteFiles.inputSchema.parse(validInput)).not.toThrow();
@ -53,9 +50,7 @@ describe('delete-files-tool', () => {
it('should reject invalid input schema', () => { it('should reject invalid input schema', () => {
const invalidInput = { const invalidInput = {
files: [ files: [{}],
{ },
],
}; };
expect(() => deleteFiles.inputSchema.parse(invalidInput)).toThrow(); expect(() => deleteFiles.inputSchema.parse(invalidInput)).toThrow();
@ -142,10 +137,7 @@ describe('delete-files-tool', () => {
it('should handle mixed success and error results', async () => { it('should handle mixed success and error results', async () => {
const input = { const input = {
files: [ files: [{ path: '/test/file1.txt' }, { path: '/test/file2.txt' }],
{ path: '/test/file1.txt' },
{ path: '/test/file2.txt' },
],
}; };
const mockLocalResult = [ const mockLocalResult = [
@ -161,10 +153,12 @@ describe('delete-files-tool', () => {
}); });
expect(result.successes).toEqual(['/test/file1.txt']); expect(result.successes).toEqual(['/test/file1.txt']);
expect(result.failures).toEqual([{ expect(result.failures).toEqual([
{
path: '/test/file2.txt', path: '/test/file2.txt',
error: 'Permission denied', error: 'Permission denied',
}]); },
]);
}); });
it('should handle empty files array', async () => { it('should handle empty files array', async () => {

View File

@ -6,11 +6,13 @@ import { z } from 'zod';
import { type SandboxContext, SandboxContextKey } from '../../../context/sandbox-context'; import { type SandboxContext, SandboxContextKey } from '../../../context/sandbox-context';
const deleteFilesInputSchema = z.object({ const deleteFilesInputSchema = z.object({
files: z.array( files: z
.array(
z.object({ z.object({
path: z.string().describe('File path to delete (absolute or relative)'), path: z.string().describe('File path to delete (absolute or relative)'),
}) })
).describe('Array of file deletion operations to perform'), )
.describe('Array of file deletion operations to perform'),
}); });
const deleteFilesOutputSchema = z.object({ const deleteFilesOutputSchema = z.object({

View File

@ -47,6 +47,7 @@ describe('RedshiftAdapter', () => {
user: 'testuser', user: 'testuser',
password: 'testpass', password: 'testpass',
ssl: true, ssl: true,
connectionTimeoutMillis: 60000,
}); });
expect(mockClient.connect).toHaveBeenCalled(); expect(mockClient.connect).toHaveBeenCalled();
}); });

View File

@ -40,10 +40,8 @@ export class RedshiftAdapter extends BaseAdapter {
ssl: redshiftCredentials.ssl ?? true, // SSL is typically required for Redshift ssl: redshiftCredentials.ssl ?? true, // SSL is typically required for Redshift
}; };
// Handle connection timeout // Handle connection timeout - default to 60 seconds for serverless
if (redshiftCredentials.connection_timeout) { config.connectionTimeoutMillis = redshiftCredentials.connection_timeout || 60000;
config.connectionTimeoutMillis = redshiftCredentials.connection_timeout;
}
// Set default schema if provided // Set default schema if provided
if (redshiftCredentials.schema) { if (redshiftCredentials.schema) {