Skip to content

v1.19.0

Compare
Choose a tag to compare
@olivermrbl olivermrbl released this 14 Dec 14:49
· 995 commits to develop since this release

Highlights

Cart-completion strategy response

🚧 Breaking change

Attempting to complete an already completed cart will no longer return a 409 conflict. Instead, the order or swap associated with the completed cart is returned.

More specifically, the response will take one of the following two shapes:

// completing a regular cart
{
  response_code: 200,
  response_body: { data: order, type: "order" },
}

// completing a swap cart
{
  response_code: 200,
  response_body: { data: swap, type: "swap" },
}

node-redis replaced with ioredis for session management

🚧 Important change

Our default Express session store has been changed from node-redis to ioredis.

This was done in response to a request for higher configurability of the Redis client used for session management. It was decided to not only expose more options but simultaneously change the library to ioredis to be consistent with other packages that use Redis, e.g. the Redis Event Bus + Redis Cache.

Add to cart performance improvements

The add-to-cart endpoint, POST /store/carts/:id/line-items, has been refactored, improving performance and transaction management. The latter was done in response to some users experiencing issues with concurrent requests leading to database conflicts. The changes to transaction management in the endpoint should significantly reduce the risk of this issue occurring while improving performance.

Some rough benchmarks show that for 1000 requests (10-20/s), we see approx. 30% of requests fail due to database conflicts in the latest version. With this PR, 0% of requests fail – even under a higher load.

New cluster command added to @medusajs/medusa-cli

A new cluster command has been added to our CLI, @medusajs/medusa-cli:

medusa start-cluster --cpus 3 

The command allows you to start Medusa in cluster mode. By default, cluster mode will try to consume all available CPUs for Medusa instances. You can specify the number of CPUs with a CLI argument --cpus.

Running in cluster mode will likely significantly improve performance as the workload and tasks are distributed among all available instances instead of a single one.

Retry support in medusa-react

🚧 Important change

You can now specify maxRetries as a prop to the MedusaProvider from medusa-react. This config is passed on to the underlying medusa-js client, which means failed requests are retried the amount of times specified by the param. If not provided, the maxRetries defaults to 3.

import { MedusaProvider as Provider } from "medusa-react"
import { queryClient } from "../constants/query-client"

export const MedusaProvider = ({ children }) => {
  return (
    <Provider
      queryClientProviderProps={{
        client: queryClient,
      }}
      baseUrl={process.env.MEDUSA_BACKEND_URL}
      maxRetries={2}
    >
      {children}
    </Provider>
  )
}

Features

  • feat(link-modules, pricing, product, utils): Should be able to set some custom database config even in shared mode by @adrien2p in #5755
  • feat(medusa): Respond with order when cart is already completed by @olivermrbl in #5766
  • feat(medusa-cli): add monorepo support command develop by @driver005 in #5723
  • feat(admin): Add Korean language support by @iweurman in #5769
  • feat(medusa-payment-klarna): Add language variable by @edinskeja in #4483
  • feat(medusa): Improve add line item to cart perf and transaction management + clustering start command by @adrien2p in #5701
  • feat(medusa): Replace Node Redis with ioredis by @pepijn-vanvlaanderen in #5656
  • feat(core-flows,pricing,medusa,pricing,types,utils): Price List Prices can have their own rules by @riqwan in #5752
  • feat(medusa): Emit "discount.created" event when discount is created by @Arsenalist in #5816
  • feat(orchestration,core-flows,medusa,product,types,utils): product import/export uses workflows by @riqwan in #5811
  • feat(medusa, core-workflows, product): slightly improve create cart workflow by @adrien2p in #5725
  • feat(admin-ui): metadata for categories in admin ui and refactor to react-hook-form by @luluhoc in #5697

Bugs

Docs

Chores

  • chore(): Add engines to all package.json if needed by @adrien2p in #5812
  • chore(medusa): Prefer logger instead of console.log by @adrien2p in #5846

New Contributors

Full Changelog: v1.18.1...v1.19.0