MCPcopy Create free account
hub / github.com/MALSync/MALSync / init

Method init

src/_provider/Search/rulesClass.ts:36–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 }
35
36 public async init() {
37 this.state = await this.getCache();
38
39 if (
40 !this.state ||
41 (this.state.provider === 'firebase' &&
42 this.state.updated &&
43 this.state.updated + 7 * 24 * 60 * 60 * 1000 < new Date().getTime())
44 ) {
45 const tempState = await this.api();
46 if (tempState) this.state = tempState;
47 }
48
49 this.logger.m('Result').log(this.state);
50
51 if (this.state) {
52 await this.setCache(this.state);
53 }
54 return this;
55 }
56
57 public getRules() {
58 if (this.state && this.state.rules && this.state.rules.length) return this.state.rules;

Callers 3

initProgressFunction · 0.45
fnFunction · 0.45
initRulesMethod · 0.45

Calls 3

getCacheMethod · 0.95
apiMethod · 0.95
setCacheMethod · 0.95

Tested by

no test coverage detected