我正在使用Shopify SDK时从服务器中获取数据。这真的是很慢的反应。获取响应然后渲染UI大约需要13秒。我已经调试了该应用程序,并且知道响应来晚了。相同的代码在其他应用程序中的响应时间为4-5秒。
graphClient = GraphClient.builder(getMainActivity()).shopDomain("abc.myshopify.com").accessToken("********").defaultHttpCachePolicy(HttpCachePolicy.CACHE_FIRST.expireAfter(5, TimeUnit.MINUTES)).build();
Storefront.QueryRootQuery queryRootQuery = Storefront.query(rootQuery -> rootQuery
.node(new ID(banner_id), nodeQuery -> nodeQuery
.onCollection(collectionQuery -> collectionQuery
.products(args1 -> args1.first(200)
.after(productPageCursor), productConnectionQuery -> productConnectionQuery
.pageInfo(pageInfoQuery -> pageInfoQuery
.hasNextPage())
.edges(edgeQuery -> edgeQuery
.cursor()
.node(nodProductQuery -> nodProductQuery
.title()
.description()
.productType()
.publishedAt()
.onlineStoreUrl()
.variants(args1 -> args1.first(20), variantConnectionQuery -> variantConnectionQuery
.edges(variantEdgeQuery -> variantEdgeQuery
.node(productVariantQuery -> productVariantQuery
.price()
.compareAtPrice()
.availableForSale()
.available()
.selectedOptions(_queryBuilder -> _queryBuilder
.value()
.name()))))
.images(args2 -> args2.first(1), imageConnectionQuery -> imageConnectionQuery
.edges(imageEdgeQuery -> imageEdgeQuery
.node(_queryBuilder -> _queryBuilder
.src())))))))));
QueryGraphCall queryGraphCall = graphClient.queryGraph(queryRootQuery);