Skip to content

Instantly share code, notes, and snippets.

View dmozgovoi's full-sized avatar

Dmitrii Mozgovoi dmozgovoi

View GitHub Profile
@dmozgovoi
dmozgovoi / mongo-timeouts.ts
Created January 8, 2024 13:55
Test example of mongo maxTimeMS option usage
const { MongoClient } = require('mongodb');
// update according to your setup
const url = 'mongodb://localhost:27022';
const dbName = 'test';
const collectionName = 'test-timeouts';
const fillData = async () => {
const client = new MongoClient(url);
@dmozgovoi
dmozgovoi / HttpClient.ts
Created October 19, 2022 08:00
HttpClient variation with flexible output format parsing
import * as http from 'http';
import * as https from 'https';
import got, { Got, ExtendOptions, Headers, CancelableRequest, Response } from 'got';
import CacheableLookup from 'cacheable-lookup';
import { decodeData, TypeOf, TSchema } from '../decoder';
export const DefaultHttpClientOptions = {
keepAlive: true,
maxSockets: 10,