Skip to content

Commit

Permalink
fix: Fix PG pool as undefined constructor (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmin-petrescu committed Apr 22, 2020
1 parent 3ffeafa commit 0629ecb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/tiler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as pg from 'pg';
import { TileInput, TileRenderer, TileServerConfig } from './types/index';
import { Cache, defaultCacheOptions } from './cache';
import {
Expand All @@ -16,7 +15,8 @@ export async function TileServer<T>({
attributes = [],
debug = false,
}: TileServerConfig<T>): Promise<TileRenderer<T>> {
const pool = new pg.Pool({
const { Pool } = require('pg');
const pool = new Pool({
max: 100,
...pgPoolOptions,
});
Expand Down Expand Up @@ -78,7 +78,7 @@ export async function TileServer<T>({
debug,
zoomToDistance,
});
const result = await pool.query<{ mvt: any }>(query.sql, query.values);
const result = await pool.query(query.sql, query.values);
debug && console.timeEnd('query' + id);

debug && console.time('gzip' + id);
Expand Down

0 comments on commit 0629ecb

Please sign in to comment.