Skip to content

Commit

Permalink
RD-15710: Store the table definitions so that they are reused when ta…
Browse files Browse the repository at this point in the history
…bleDefinitions is called again (#37)

This upgrade of das-server permit to cache a DAS instance and reuse it
when recreating the same DAS. The code change is to store table
definitions once for all in a variable, so that if the same instance is
reused, it can immediately return its table definitions.
  • Loading branch information
bgaidioz authored Nov 27, 2024
1 parent 9ce7d23 commit 5675372
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,5 @@ lazy val docker = (project in file("docker"))
.settings(
strictBuildSettings,
dockerSettings,
libraryDependencies += "com.raw-labs" %% "das-server-scala" % "0.1.5" % "compile->compile;test->test"
libraryDependencies += "com.raw-labs" %% "das-server-scala" % "0.1.7" % "compile->compile;test->test"
)
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ class DASSalesforce(options: Map[String, String]) extends DASSdk with StrictLogg

private val allTables = staticTables ++ dynamicTables ++ maybeDatedConversionRateTable

override def tableDefinitions: Seq[TableDefinition] = allTables.map(_.tableDefinition)
// These are the table definitions that will be returned to the client. It's stored
// in a val to avoid recalculating it every time it's accessed. We do that because we
// don't expect the tables to change during the lifetime of the DAS instance.
private val definitions = allTables.map(_.tableDefinition)

override def tableDefinitions: Seq[TableDefinition] = definitions

override def functionDefinitions: Seq[FunctionDefinition] = Seq.empty

Expand Down

0 comments on commit 5675372

Please sign in to comment.