File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ import {
14
14
PatternMatching ,
15
15
ToriiClient ,
16
16
} from "@dojoengine/torii-client" ;
17
-
18
17
import { convertValues } from "../utils" ;
19
18
20
19
/**
@@ -158,7 +157,8 @@ export const getEntities = async <S extends Schema>(
158
157
let offset = 0 ;
159
158
let continueFetching = true ;
160
159
161
- let time = getCache ( timestampCacheKey ) ;
160
+ const time = dbConnection ? getCache ( timestampCacheKey ) : 0 ;
161
+
162
162
while ( continueFetching ) {
163
163
const entities = await client . getEntities ( {
164
164
limit,
@@ -174,7 +174,7 @@ export const getEntities = async <S extends Schema>(
174
174
await insertEntitiesInDB ( dbConnection , entities ) ;
175
175
}
176
176
177
- if ( logging ) console . log ( `Fetched ${ entities } entities` ) ;
177
+ if ( logging ) console . log ( `Fetched entities` , entities ) ;
178
178
179
179
setEntities ( entities , components , logging ) ;
180
180
@@ -184,8 +184,11 @@ export const getEntities = async <S extends Schema>(
184
184
offset += limit ;
185
185
}
186
186
}
187
- const currentTime = Math . floor ( Date . now ( ) / 1000 ) ;
188
- setCache ( currentTime , timestampCacheKey ) ;
187
+
188
+ if ( dbConnection ) {
189
+ const currentTime = Math . floor ( Date . now ( ) / 1000 ) ;
190
+ setCache ( currentTime , timestampCacheKey ) ;
191
+ }
189
192
} ;
190
193
191
194
/**
You can’t perform that action at this time.
0 commit comments